   [D3D9] strange alt-tabbing problem
  In testing my lose/gain focus code, I noticed a weird problem.  If I alt-tab out of my app, I can't alt-tab back in.  The windows alt-tabbing display pops up and I tab through to my app, but the app never resumes execution.However, if I click on the app's icon in the taskbar, it restores without issue.I'm using a very simple test for losing/gaining focus.  Around my main loop I have:if (GetForegroundWindow()==hWnd) // ensure app is foreground window{if (app->bMinimized) // restoring a window{// do restoration stuff here (also sets   app->bMinimized=false;}// handle messages / do game loop here}else if (!app->bMinimized) // lost focus, so minimize it{// tell the app to minimize here   app->bMinimized=true;}if (app->bMinimized){Sleep(500); // reduce cpu load}}Nice and simple.  I snipped out all the irrelevant code.I originally had it set up to handle WM_ACTIVATE messages in the default windows proc, but I found the app wasn't receiving the re-activation message properly, so I switched to this method.If this problem was just the alt-tab not working, I'd assume it was a reset/restore issue, but the fact that I can click back into the window and it resets/restores without issue makes me think the problem is something more obscure.Anyone ever come across this before?  Or perhaps have an idea where to dig around to find the cause?   
Quote:Original post by DamoclesI originally had it set up to handle WM_ACTIVATE messages in the default windows proc, but I found the app wasn't receiving the re-activation message properly, so I switched to this method.WM_ACTIVATE is the correct way to handle this.Are you definitely running your window message pump when the window isn't focused? If you're not, then you'll never process any messages (Including WM_ACTIVATE) - I'd guess that this is the problem.   ;  I'm pretty sure I was.  I'll redo the WM_ACTIVATE method and see if I can get it to work properly this time.edit:And WM_ACTIVATE works like a charm this time.  I guess I must have been skipping over the messages before.  Funny, I could have sworn I checked they were being processed, but I guess I stuffed up somewhere.Thanks Steve.   ;  Also, does this happen in windowed mode, fullscreen, or both?   