Sign in to follow this  

Window focus problems

Recommended Posts

Hi! I've got this nasty problem with a number of my programs. I set up a message loop that uses PeekMessage, and in the free time it calls Game->Update(). Game->Update check if the required amount of time has passed and either makes an update of the screen, or returns. Also, there is a variable updating, which is set to 0 when the window is minimized etc. - so that it "turns off" updating. Now, when the program is running and i click in a different window, sometimes( not always) rather than just loosing focus, the game "sort of" makes one additional update. The result is that although the focus moves to the proper window and my game stops updating, the window area of the app i switched to is overwritten by the game image. Debugging seems to suggest, that the order of events is this: 1. The second app gets a WM_ACTIVATEAPP/WM_ACTIVE AND WM_PAINT 2. My app makes an update 3. My app gets a message telling it to deactivate( i tried WM_ACTIVE, WM_ACTIVATEAPP, WM_KILLFOCUS/WM_SETFOCUS, WM_ENABLE and WM_SHOWWINDOW - all methods produce the same effect). Anyone have an idea about what to do with this?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this