Advertisement

Restoring Surfaces

Started by November 05, 2000 08:23 PM
5 comments, last by vbisme 24 years, 2 months ago
When the user presses Alt+Tab during my program it minimizes. When the user wants to go back to the program, there''s nothing on screen. How do I fix this problem?
Funny

You have the answer into the title of your post..

Restore the surfaces of course when your app gets maximized again...what else?

If surfaces are into video ram u also have to reload them with bitmaps

Bogdan
obysoft
Advertisement
Not sure if this will help or not, but what I did to fix this was simple:

If a surface fails to blit then it must be lost, so...reload it.

if (!Surface->Draw(....) )
{
//reload
}

-Tim
Well hehehe, what function do I use to restore surfaces?
lpDirectDraw->RestoreAllSurfaces();

(i think; you must be using DX6 or better...)


ill-lusion.com

ziggy@ill-lusion.com
laxdigital.com
[email=ziggy@laxdigital.com]ziggy@laxdigital.com[/email]
isn''t there some kind of test condition that you can see if the Alt+Tab is pressed or not so that you could call the
lpDD->RestoreAllSurfaces()

Please show me how to test for that condition, thanks.
Advertisement
To restore a surface use DirectDraw7::RestoreAllSurfaces() to restore all surfaces that was created or use DirectDrawSurface7::Restore() to restore a single surface.

To test if a surface is lost use DirectDrawSurface7::IsLost(). If this function returns DDERR_SURFACELOST then the surface is lost and you have to restore it. Also remember to reload bitmaps onto the surface when you have restored it.

-René

This topic is closed to new replies.

Advertisement