DirectX SDK

DirectDrawSurface7.Restore

The DirectDrawSurface7.Restore method restores a surface that has been lost. This occurs when the surface memory associated with the DirectDrawSurface object has been freed.

object.Restore()

Parameters

object
Object expression that resolves to a DirectDrawSurface7 object.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_GENERIC
DDERR_IMPLICITLYCREATED
DDERR_INCOMPATIBLEPRIMARY
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_NOEXCLUSIVEMODE
DDERR_OUTOFMEMORY
DDERR_UNSUPPORTED
DDERR_WRONGMODE

Remarks

This method restores the memory allocated for a surface, but does not reload any bitmaps that might have existed in the surface before it was lost. Only surfaces that were created with the DDSCAPS2_PERSISTENTCONTENT flag have their contents automatically restored. When surfaces without this capability are lost, you must completely reconstitute the graphics that they once held after you restore their memory.

Surfaces can be lost because the mode of the display card was changed or an application received exclusive access to the display card and freed all surface memory currently allocated on the card. When a DirectDrawSurface object loses its surface memory, many methods return DDERR_SURFACELOST and perform no other function. The DirectDrawSurface7.Restore method reallocates surface memory and reattaches it to the DirectDrawSurface object.

A single call to this method restores a DirectDrawSurface object's associated implicit surfaces (back buffers, and so on). An attempt to restore an implicitly created surface results in an error. DirectDrawSurface7.Restore does not work across explicit attachments created by using the DirectDrawSurface7.AddAttachedSurface method—each of these surfaces must be restored individually.

See Also

DirectDrawSurface7.IsLost