Skip to main content
gamedev.net
🔒 Locked

Alt-tab problem

Started by Doolwind 6 replies 550+ views
Original Post
Doolwind
Doolwind
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:
  
    HRESULT result = g_pd3dDevice->Present( NULL, NULL, NULL, NULL );									// Present the backbuffer contents to the display


	if (D3DERR_DEVICELOST == result)
		RestoreStuff();
  
The restoration code looks like this:
  
  	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;
	}	
  
As far as I can tell "Reset" is being called over and over and not actually resetting the device. Thanks Doolwind
Foxhound
Foxhound
Maybe the Reset function failes because of another reason?!
Check your debugwindow (make sure Direct3D runs in debug version)
Doolwind
Doolwind
Thanks Foxhound,

I''m looking into the problem, I am just having problems setting D3D to debug mode, my previous installation used it, but for some reason it won''t let me change from the retail version. Will have to reinstall SDK again.

Doolwind
haro
haro
quote:
Original post by Doolwind
Thanks Foxhound,

I''m looking into the problem, I am just having problems setting D3D to debug mode, my previous installation used it, but for some reason it won''t let me change from the retail version. Will have to reinstall SDK again.

Doolwind


You likely installed the DX9.0a recently. Its a runtime release version only last time I checked.
Doolwind
Doolwind
quote:
Original post by haro
You likely installed the DX9.0a recently. Its a runtime release version only last time I checked.


Yep, DX9 doesn''t seem to want to let DX8 back on, I can''t even just plain uninstall DX9....grrr.

I have found that it is definately that my "Reset" is failing, I''ll try and get debug mode working so I can give more information.

Thanks for the feedback so far.

Doolwind

Doolwind
Doolwind
I'm still having no luck with stopping my reset from failing. I have double checked that I have released all of the vertex buffer information before I call reset.

Is there anything else I have to release other than vertex buffer information?? I tried looking at the HRESULT return from reset but it doesn't match the three possibilities listed in the SDK, the number is simply -2005530520.

Doolwind

[edited by - Doolwind on May 19, 2003 9:15:43 PM]
Doolwind
Doolwind
I''ve got it!!

I have to release EVERYTHING, including my textures. The example I was going by didn''t release it''s texture, and the SDK didn''t say anything about it so I assumed I didnt have to.

Thanks for the help everyone...now If i can just reinstall DX8 with debug mode.

Doolwind
djc
djc
It''s possible install an older version of dx sdk over the current version if you change the version flag in your registry..

..somewhere in Local Machine/Software/Microsoft/DirectX

...there''s a version....just change it to a lower version and the installation will work...

...don''t know if it might cause any dll conflicts anywhere...so...do the change at your own risk!!!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.