Updating text in dialog box when it's inactive - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Updating text in dialog box when it's inactive

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 );


I appreciate any input, thank you.


  • misfit5000misfit5000 Posts: 4Member
    I would have to see the complete code, but without looking I would say you should try sending the edit control a paint message or UpdateWindow, or InvalidateRect message??

    I would try....
    RECT rc;
    HWND hwnd = GetDialogItem(hDialog,IDC_EDIT2);
Sign In or Register to comment.