DirectX SDK

Losing and Restoring Surfaces

The surface memory associated with a DirectDrawSurface object may be freed, while the DirectDrawSurface objects representing these pieces of surface memory are not necessarily released. When a DirectDrawSurface object loses its surface memory, many methods return DDERR_SURFACELOST and perform no other action.

[C++]

Surfaces can be lost because the display mode was changed or because another application received exclusive access to the display card and freed all of the surface memory currently allocated on the card. The IDirectDrawSurface7::Restore method re-creates these lost surfaces and reconnects them to their DirectDrawSurface object. If your application uses more than one surface, you can call the IDirectDraw7::RestoreAllSurfaces method to restore all of your surfaces at once.

[Visual Basic]

Surfaces can be lost because the display mode was changed or because another application received exclusive access to the display card and freed all of the surface memory currently allocated on the card. The DirectDrawSurface7.Restore method re-creates these lost surfaces and reconnects them to their DirectDrawSurface object. If your application uses more than one surface, you can call the DirectDraw7.RestoreAllSurfaces method to restore all of your surfaces at once.

Restoring a surface doesn't reload any bitmaps that may have existed in the surface prior to being lost. You must completely reconstitute the graphics they once held.