if (msg == WM_ACTIVATE)
{
if (LOWORD(wparam) == WA_INACTIVE)
bFocus = FALSE;
else
bFocus = TRUE;
// tell Windows we handled it
return(0);
}
what does bFocus do? is it supposed to be used somewhere else?
it seems pretty useless from where it is now.
if (WM_ACTIVE) bFocus = true; What exactly does bFocus do?
I''ve seen it this piece of code:
If it's false the window doesn't have focus and doesn't need to do anything except wait for the next message. If you're using GetMessage() everything is fine, it will block until a new message arrives. If you are using PeekMessage() you will keep calling it even though your window might not have any messages because it's not in focus. So, in your PeekMessage loop add:
Forgot to mention, only do that or use GetMessage() if your program can afford to hold when not in focus. If you have to do anything in the background, even if the user is away (network comm for example), it will get suspended as well, so use PeekMessage and don't check for focus.
------------
- outRider -
[edited by - outRider on July 5, 2003 2:58:05 PM]
if (bFocus == FALSE) WaitMessage();
Forgot to mention, only do that or use GetMessage() if your program can afford to hold when not in focus. If you have to do anything in the background, even if the user is away (network comm for example), it will get suspended as well, so use PeekMessage and don't check for focus.
------------
- outRider -
[edited by - outRider on July 5, 2003 2:58:05 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement