Archived

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

devious

inducing DDERR_SURFACELOST

Recommended Posts

devious    122
I have some code checking for DDERR_SURFACELOST which tells my program when the user alt+tabs out of fullscreen mode or changes the desktop resolution. I could reuse the same code to change my application resolution if I could somehow force DDRAW to cough a DDERR_SURFACELOST message. Please let me know if the description of my problem isn''t clear. I''ll rephrase. Thanks!

Share this post


Link to post
Share on other sites
S1CA    1418
You tend to get a lost surface when you switch to a desktop which has a higher bit depth and resolution than the fullscreen app... so you could change the desktop display settings with GDI calls (same way that some OpenGL folks do) then use a FlipToGDISurface() [or whatever the API call is]...

Alternatively just change the code which checks for lost surface from "if (hr==DDERR_SURFACELOST)" to "if (hr==DDERR_SURFACELOST || bMyVeryDirtyModeChangeHack==true)"

...however - it''s not guaranteed to work on all hardware, on all OS combinations etc - generally it''s a very lame way to programatically change mode though! somethings broken in your design if causing an error is the easiest way of achieving that!.
(Akin to smashing the windscreen on your car because and putting in a new one because you couldn''t see out of it and you were too lazy to wash the window).

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
devious    122
Changing the application resolution and adapting to a resolution change in the OS amounts to the same thing: I have to basically "reload" ddraw. That''s why I want to reuse the same code. I will write general pieces of code when I can, and scattered specialized piece of code if I must.

I would rather not use DERR_SURFACELOST at all if I could always detect resolution changes before they occur. It doesn''t seem possible to do that. I didn''t find how to do it, and nobody could answer to that question so far (see thread "detecting resolution changes with DX7", DirectX forum). So I have to live with DERR_SURFACELOST.

Would someone who has programmed full resolution switching behavior in his application provide me with an insight please? Thank you!

Share this post


Link to post
Share on other sites