Microsoft DirectX 9.0

IDirectDrawSurface::Restore

The Restore method restores a surface that has been lost—that is, the surface memory associated with the DirectDrawSurface object has been freed. Surfaces can be lost because the mode of the display card was changed or because an application received exclusive access to the display card and freed all of the surface memory currently allocated on the video card. When a DirectDrawSurface object loses its surface memory, many methods will return DDERR_SURFACELOST and perform no other function. Restore will reallocate surface memory and reattach it to the DirectDrawSurface object.

A single call to Restore will restore a DirectDrawSurface's associated implicit surfaces. An attempt to restore an implicitly created surface will result in an error. Restore will not work across explicit attachments created using the AddAttachedSurface method; each of these surfaces must be restored individually.

Syntax

HRESULT Restore();

Parameters

This method takes no parameters.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_IMPLICITLYCREATED This surface can not be restored because it is an implicitly created surface.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_WRONGMODE This surface can not be restored because it was created in a different mode.
DDERR_OUTOFMEMORY DirectDraw does not have enough memory to perform the operation.
DDERR_NOEXCLUSIVEMODE Operation requires the application to have exclusive mode but the application does not have exclusive mode.
DDERR_GENERIC Generic failure.
DDERR_INCOMPATIBLEPRIMARY Unable to match primary surface creation request with existing primary surface.
DDERR_UNSUPPORTED Action not supported.

See Also