Original Post
Hi everyone,
I am trying to allow the user to alt-tab from my full-screen application to the desktop and back again (DX8). Unfortunately when they come back the system sits in a continous loop resetting the screen. I have read my textbook (Real-time rendering tricks and techniques) and checked the web, but I can''t seem to find the solution.
Here is my code:
Firstly, I check if the "present" call failed, if so I run my restoration code:
The restoration code looks like this:
As far as I can tell "Reset" is being called over and over and not actually resetting the device.
Thanks
Doolwind
HRESULT result = g_pd3dDevice->Present( NULL, NULL, NULL, NULL ); // Present the backbuffer contents to the display
if (D3DERR_DEVICELOST == result)
RestoreStuff();
HRESULT Result = g_pd3dDevice->TestCooperativeLevel();
while(Result == D3DERR_DEVICELOST)
{
while(Result != D3DERR_DEVICENOTRESET) //When devicenotreset, we can go head and reset it
{
Sleep(1000);
MSG Message;
PeekMessage(&Message, 0, 0, 0, PM_REMOVE);
TranslateMessage(&Message);
DispatchMessage(&Message);
Result = g_pd3dDevice->TestCooperativeLevel();
}
//Reset the device using the saved parameters
if (FAILED(g_pd3dDevice->Reset(&d3dpp)))
Result = D3DERR_DEVICELOST;
}