IDirectDrawSurface2::Flip

HRESULT Flip(

LPDIRECTDRAWSURFACE2 lpDDSurfaceTargetOverride,

DWORD dwFlags);

Makes the surface memory associated with the DDSCAPS_BACKBUFFER surface become associated with the front-buffer surface.

·Returns DD_OK if successful, or one of the following error values otherwise:

DDERR_GENERIC

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_NOFLIPHW

DDERR_NOTFLIPPABLE

DDERR_SURFACEBUSY

DDERR_SURFACELOST

DDERR_UNSUPPORTED

DDERR_WASSTILLDRAWING

lpDDSurfaceTargetOverride

Address of the DirectDraw surface that will be flipped to. The default for this parameter is NULL, in which case IDirectDrawSurface2::Flip cycles through the buffers in the order they are attached to each other. This parameter is used only as an override.

dwFlags

DDFLIP_WAIT

Typically, if the flip cannot be set up because the state of the display hardware is not appropriate, the DDERR_WASSTILLDRAWING error returns immediately and no flip occurs. Setting this flag causes IDirectDrawSurface2::Flip to continue trying to flip if it receives the DDERR_WASSTILLDRAWING error from the HAL. IDirectDrawSurface2::Flip does not return until the flipping operation has been successfully set up, or if another error, such as DDERR_SURFACEBUSY, is returned.

This method can be called only by a surface that has the DDSCAPS_FLIP and DDSCAPS_FRONTBUFFER values set. The display memory previously associated with the front buffer is associated with the back buffer. If there is more than one back buffer, a ring is formed and the surface memory buffers cycle one step through it every time IDirectDrawSurface2::Flip is called.

The lpDDSurfaceTargetOverride parameter is used in rare cases when the back buffer is not the buffer that should become the front buffer. Typically this parameter is NULL.

The IDirectDrawSurface2::Flip method will always be synchronized with the vertical blank.