我从第二个文本框中读取数据IDC_MAIN_OUTPUT
时遇到问题。我只能显示第一个文本框的内容IDC_MAIN_INPUT
。我已经尝试了各种方法来解决但仍然无法解决问题。到目前为止,这是我的代码:
switch (msg)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_MAIN_BUTTON:
char *bufIn, *bufOut;
int lenIn = GetWindowTextLength(GetDlgItem(hwnd, IDC_MAIN_INPUT));
int lenOut = GetWindowTextLength(GetDlgItem(hwnd, IDC_MAIN_OUTPUT));
bufIn = (char*)GlobalAlloc(GPTR, lenIn + 1);
GetDlgItemText(hwnd, IDC_MAIN_INPUT, bufIn, lenIn + 1);
bufOut = (char*)GlobalAlloc(GPTR, lenOut + 1);
GetDlgItemText(hwnd, IDC_MAIN_OUTPUT, bufOut, lenOut + 1);
MessageBox(NULL, bufIn, "String", NULL);
MessageBox(NULL, bufOut, "String", NULL);
//MessageBox(NULL, input, "Title Here", MB_OK);
mc.application(bufIn, bufOut);
}
break;
case WM_CREATE:
CreateObjects(hwnd);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}