HRESULT Restore();
Restores a surface that has been lost. This occurs when the surface memory associated with the DirectDrawSurface object has been freed.
·Returns DD_OK is successful, or one of the following error values otherwise:
DDERR_GENERIC | DDERR_INCOMPATIBLEPRIMARY |
DDERR_IMPLICITLYCREATED | DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS | DDERR_NOEXCLUSIVEMODE |
DDERR_OUTOFMEMORY | DDERR_UNSUPPORTED |
DDERR_WRONGMODE |
Surfaces can be lost because the display card's mode was changed or because an application received exclusive access to the display card and freed all of the surface memory currently allocated on the card. When a DirectDrawSurface object loses its surface memory, many methods will return DDERR_SURFACELOST and perform no other function. The IDirectDrawSurface::Restore method will reallocate surface memory and reattach it to the DirectDrawSurface object.
A single call to this method will restore a DirectDrawSurface's associated implicit surfaces (back buffers, and so on). An attempt to restore an implicitly created surface will result in an error. IDirectDrawSurface::Restore will not work across explicit attachments created using the IDirectDrawSurface::AddAttachedSurface method — each of these surfaces must be restored individually.