I am creating a simple chat program where clients can send messages to a server, which shows the received messages. For some reason, I can’t type in the textbox even though its not set to read only. Can anyone see the simple error without me posting the entire code? This is where i create the textbox:
static HWND text;
switch(msg)
{
case WM_CREATE:
{
text = CreateWindow(TEXT("Edit"), TEXT("Enter text here..."),
WS_VISIBLE | WS_CHILD | WS_BORDER,
0, 0, 300, 25,
hwnd, (HMENU) ID_EDIT, NULL, NULL);
CreateWindow(TEXT("Button"), TEXT("Post"),
WS_VISIBLE | WS_CHILD,
310, 0, 70, 25,
hwnd, (HMENU) ID_POST, NULL, NULL);
CreateWindow(TEXT("Button"), TEXT("Connect"),
WS_VISIBLE | WS_CHILD,
0, 35, 70, 25,
hwnd, (HMENU) ID_CONNECT, NULL, NULL);
break;
}
Applying my mental powers, I’d say that you wrote your own message loop in the main function and that you are not calling
TranslateMessage().Function
TranslateMessage()is responsible for converting key messages into char messages (no, that’s not done automatically :-). The end result is that your EDIT windows (all your windows) do not receiveWM_CHARmessages.So your message loop should at least have something like this: