Archived

This topic is now archived and is closed to further replies.

Nothing is done till either task switch or mouse over

This topic is 4999 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My problem is that I''m trying to code a kind of Messenger/ICQ program and the windows don''t add the text received until the user puts either mouse over the window (main or chat) or switches to them. my question is, how do you make the program run in background so I can get that window to flash on message arrival?

Share this post


Link to post
Share on other sites
As far as I can tell, that''s not the issue. I check for incoming on the windows socket in a while loop that, as far as I can tell doesn''t stop going thru even without any messages being sent. As for the flashwindow, I knew about that I just need to check why the window doesn''t do anything until I do something. You might be right about the message thing though, I just can''t find out where that might be.

Share this post


Link to post
Share on other sites

while (GetMessage(&msg, NULL, 0, 0))
{
// if (CheckWindows(&msg))

// continue;

CheckIncoming (hWnd);
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}


this is the main loop. CheckIncoming checks the winsock buffer for any received stuff, now I'm not too sure about the rest since I've only begun the Windows API programming.

[edited by - MaxxJag on April 3, 2004 12:52:40 PM]

Share this post


Link to post
Share on other sites
Ah. See, GetMessage blocks until a window message arrives - so your CheckIncoming won't get called until you move the mouse or click on something. Try this instead:

while( true )
{
CheckIncoming(hwnd);
if( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) &&
!TranslateAccelerator(msg.hwnd, hAccelTable, &msg) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Sleep(0); // play nice with other apps

}

[Edit: Left out TranslateAccelerator.]

[edited by - Oluseyi on April 3, 2004 2:05:17 PM]

Share this post


Link to post
Share on other sites