1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
case WM_COMMAND:
switch (LOWORD(wParam))
{
case INPUT_BUTTON:
char DistanceText[256], TimeText[256], DateText[256];
//Get the text from 3 different edit boxes
GetWindowText(GetDlgItem(hwnd, DISTANCE_BOX) ,(LPWSTR)DistanceText, GetWindowTextLength(GetDlgItem(hwnd, DISTANCE_BOX))+2);
GetWindowText(GetDlgItem(hwnd, TIME_BOX) ,(LPWSTR)TimeText, GetWindowTextLength(GetDlgItem(hwnd, TIME_BOX))+2);
GetWindowText(GetDlgItem(hwnd, DATE_BOX) ,(LPWSTR)DateText, GetWindowTextLength(GetDlgItem(hwnd, DATE_BOX))+2);
//convert the text of the 3 boxes into strings
std::string DistanceString = DistanceText;
std::string TimeString = TimeText;
std::string DateString = DateText;
//concatenate the strings together
std::string AllTextString = DistanceString+TimeString+DateString;
//convert the concatenated string back into a char array to pass it as LPWSTR
char AllText[256];
strcpy(AllText, AllTextString.c_str());
//MessageBox(hwnd,L"Are you sure?",L"",MB_OK);
MessageBox(hwnd,(LPCWSTR)AllText,L"test",MB_OK);
break;
}
break;
| |