C/C++ Windows API

Moderators: Lundin
Number of threads: 450
Number of posts: 1225

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Updating text in dialog box when it's inactive Posted by reefa on 9 Dec 2010 at 11:39 PM
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.

Thread Tree
reefa Updating text in dialog box when it's inactive on 9 Dec 2010 at 11:39 PM
misfit5000 Re: Updating text in dialog box when it's inactive on 27 Mar 2012 at 12:48 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.