Partager via


Losing and Restoring Surfaces

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Starting with Windows Embedded CE 6.0, DirectDraw surfaces may be lost by changing the rotation angle (through ChangeDisplaySettingsEx) or by switching DirectDraw into excusive mode. When a DirectDraw surface is lost, many methods will return DDERR_SURFACELOST, and perform no other function. A IDirectDrawSurface::Restore should be called to reallocate surface memory and reattach it to the DirectDrawSurface object.

A single call to IDirectDrawSurface::Restore will restore a DirectDrawSurface's associated implicit surfaces. An attempt to restore an implicitly created surface will result in an error.

Note

After restoring a surface, the surface's description can change (especially lPitch and lXPitch). Applications should be sure to always use the surface description returned by a call to IDirectDrawSurface::Lock instead of keeping a copy that is used across different calls to Lock.