   Restoring the window after minimizing(DirectX)
  I'm using DirectX 9, full-screen, and I try to restore the window after i've minimized it but it simply won't work. I guess i've missed something... here's some code:In the WndProc:  case WM_ACTIVATEAPP:if( wParam == false ){  game_state = 2;  WaitMessage();}//end ifelse{  if( game_state == 2 )    graphics->RestoreRenderer();  game_state = 0;}//end elsebreak;As you can see i'm relying on the WM_ACTIVATEAPP message. If the window is being minimized I put the game in "idle" state, waiting for a message. This works.If the window is being activated I call this function:int CGraphics::RestoreRenderer() {   HRESULT hr;   while( (hr=m_pDevice->TestCooperativeLevel()) == D3DERR_DEVICELOST )   {Sleep(100);   }//end while   if(hr == D3DERR_DEVICENOTRESET)   {hr=m_pDevice->Reset(&presentParameters);   }   return 0; }Reset returns D3DERR_INVALIDCALL... but the presentParameters structure is exactly what I pass to CreateDevice so it can't be the problem. I've read that I need to free anything I've allocated in the D3DPOOL_DEFAULT but I don't think I've allocated anything there. Just in D3DPOOL_MANAGED. I've been trying to work this out for two days... Can anyone help?   _______________The essence of balance is detachment. To embrace a cause, to grow fond or spiteful, is to lose one's balance after which, no action can be trusted. Our burden is not for the dependent of spirit.   - Mayar, Third Keeper[edited by - izhbq412 on February 6, 2004 3:55:14 PM][edited by - izhbq412 on February 7, 2004 2:18:02 AM]
  What happens when you try to restore it?   ;  A 800x600 (that''s the resolution I use in the game) black window that wouldn''t go away (unless I close it from the Task Manager).   _______________The essence of balance is detachment. To embrace a cause, to grow fond or spiteful, is to lose one''''s balance after which, no action can be trusted. Our burden is not for the dependent of spirit.   - Mayar, Third Keeper 