• Advertisement

Archived

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

Restoring the window after minimizing(DirectX)

This topic is 5127 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

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 if else { if( game_state == 2 ) graphics->RestoreRenderer(); game_state = 0; }//end else break; 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]

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites

  • Advertisement