Jump to content
  • Advertisement
Sign in to follow this  

Managed Device lost Fullscreen.

This topic is 5188 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 am pretty new to MDX but not DX, but I can't understand how to deal with the lost device (Alt+Tab) in fullscreen at all. I have gogled far an long, and most solutions I see works great for windowed, no problem there, but fullscreen keeps crashing when I try to return back to it. I even added 4 lines to the samples in the SDK to make them start in Fullscreen, but it is the same with them. They also crashes. Is it just me, or do anyone have a really good solution for this? Thanks

Share this post

Link to post
Share on other sites
Hi there BugSlayer :)
Let me try and shed some light on the matter.

[Tutorial on DeviceLost] - I was busy writing one for you and this guy made it so clear. I just had to paste it.

Responding to a Lost Device
"A lost device must re-create resources (including video memory resources) after it has been reset. If a device is lost, the application queries the device to see if it can be restored to the operational state. If not, the application waits until the device can be restored.

If the device can be restored, the application prepares the device by destroying all video-memory resources and any swap chains. Then, the application calls the Reset method. Reset is the only method that has an effect when a device is lost, and is the only method by which an application can change the device from a lost to an operational state. The method will fail unless the application releases all resources that are allocated in Default, including those created by the CreateRenderTarget and CreateDepthStencilSurface methods.

For the most part, the high-frequency calls of Direct3D do not return any information about whether the device has been lost. The application can continue to call rendering methods, such as Device.DrawPrimitives, without receiving notification of a lost device. Internally, these operations are discarded until the device is reset to the operational state.

The application can determine whether a device is lost by querying the return value of the CheckCooperativeLevel method"

So what does this mean?
This means that you should check if the device was lost using the CheckCooperativeLevel method. The Device.Present() method will throw a DeviceLostException when the device is lost and cannot be reset at this time...

So when can I reset it?
When the CheckCooperativeLevel returns a DeviceNotResetException.

What about fullscreen?
What happens when you alt-tab back to your window is that it is resizing the window. What you want to do is cancel the resize, since you set your device's presentation parameters.

[source lang = c#]
//register the event handler for DeviceResizing
device.DeviceResizing += new System.ComponentModel.CancelEventHandler(this.CancelResize);

//Cancel the resize
protected void CancelResize(object sender, System.ComponentModel.CancelEventArgs e) {
e.Cancel = true;

I hope this helps and maybe someone else with more knowledge can contribute and fill in the details.

Share this post

Link to post
Share on other sites
Was it that easy...just to cancel that event...wow..:) And I have been sitting with exceptions for a few hours..:)..life isn't fair. Wish that it wasn't that many events and exceptions in MDX, it should have been more return codes as it used to be. But except that I am pretty ok with MDX.

Thanks a bunch for your answer.
- BugSlayer -

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!