Hello there,
I've been trying to create a little IM client, for my own server. And I'm using a dialog box, with 2 edit boxes, one is read only for the output text and the other one is writable for input text to send over IM to the other client. My sockets and everything work fine, I can receive/send text. The only problem is that whenever the dialog box is inactive the output edit box does not get updated with the new text messages that I have been receiving, unless I move the mouse over the dialog box and activate it, it will display the text. Here is some code, just a basic while loop for the WINAPI.
while (status = GetMessage (& msg, 0, 0, 0)) {
char buffer[256];
if(udpSocket->ReceiveFrom(buffer) == true) {
udpSocket->SendMsg(buffer, 0); // send the received message to the output window
}
if (msg.message==WM_KEYDOWN && msg.wParam==VK_RETURN) {
char lpString[256];
GetDlgItemText(hDialog, IDC_EDIT2, lpString, 252);
SetDlgItemText(hDialog, IDC_EDIT2, 0);
if(strlen(lpString) != 0) {
udpSocket->UdpSend(lpString); // send the text to the server
}
}
if (!IsDialogMessage (hDialog, & msg))
{
TranslateMessage ( & msg );
DispatchMessage ( & msg );
}
Sleep(10);
}
I appreciate any input, thank you.