Need help with with an "EDIT"
When i click the send button, the messagebox wont display waht is in the txtMessage "EDIT" window. Instead of SendMessage i have used GetWindowText which also didnt work.
Please Help
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){
HWND txtMessage, btnSend, txtHost;
switch(msg){
case WM_CREATE:
{
HFONT hfDefault;
txtHost = CreateWindowEx(
WS_EX_STATICEDGE,
"EDIT", "",
WS_VISIBLE | WS_CHILD,
10, 10, 250, 25,
hwnd, NULL, NULL, NULL
);
txtMessage = CreateWindowEx(
WS_EX_STATICEDGE,
"EDIT", "",
WS_VISIBLE | WS_CHILD | ES_AUTOVSCROLL | WS_CHILD | ES_MULTILINE | WS_VSCROLL,
10, 45, 250, 250,
hwnd, (HMENU) 202, NULL, NULL
);
btnSend = CreateWindowEx(
WS_EX_STATICEDGE,
"BUTTON", "SEND",
WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON,
95, 300, 80, 30,
hwnd, (HMENU) IDR_BUTTON, NULL, NULL
);
hfDefault = CreateFont(18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Times New Roman");
SendMessage(txtHost, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
SendMessage(txtMessage, WM_SETFONT, (WPARAM)hfDefault, MAKELPARAM(FALSE, 0));
SetFocus(txtHost);
}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_COMMAND:
{
char buff[100];
if(LOWORD(wParam) == IDR_BUTTON){
SendMessage(txtMessage, WM_GETTEXT, (WPARAM)100, (LPARAM)buff);
MessageBox(NULL, buff, "Hello", MB_OK);
}
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}