A version of this page is also available for
This method makes the surface memory associated with the DDSCAPS_BACKBUFFER surface become associated with the front-buffer surface.
HRESULT Flip( LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags );
Address of the IDirectDrawSurface interface for an arbitrary surface in the flipping chain.
The default for this parameter is NULL, in which case DirectDraw cycles through the buffers in the order they are attached to each other.
If this parameter is not NULL, DirectDraw flips to the specified surface instead of the next surface in the flipping chain. The method fails if the specified surface is not a member of the flipping chain.
Flags specifying flip options. The following table shows the possible flags.
For use only when displaying video in an overlay surface. The new surface contains data from the even field of a video signal. This flag cannot be used with the DDFLIP_ODD flag.
DDFLIP_INTERVAL1 DDFLIP_INTERVAL2 DDFLIP_INTERVAL4
These flags indicate how many vertical retraces to wait between each flip.
The default is 1.
DirectDraw returns DERR_WASSTILLDRAWING for each surface involved in the flip until the specified number of vertical retraces has occurred.
If DDFLIP_INTERVAL2 is set, DirectDraw will flip on every second vertical sync. If DDFLIP_INTERVAL4 is set, DirectDraw will flip on every fourth sync.
These flags are effective only if DDCAPS2_FLIPINTERVAL is set in the DDCAPS structure returned for the device.
For use only when displaying video in an overlay surface. The new surface contains data from the odd field of a video signal. This flag cannot be used with the DDFLIP_EVEN flag.
Waits for a previously initiated drawing operation to complete instead of returning immediately with the DDERR_WASSTILLDRAWING return value.
If a previous drawing operation is in progress at the time of the call, this flag defers returning from the call until the new flip operation begins or an error occurs.
Waits for a V-Sync before performing the flip operation.
If the method succeeds, the return value is DD_OK.
If the method fails, the return value may be one of the following error values:
For more information on these error codes see DirectDraw Return Values.
This method can be called only for a surface that has the DDSCAPS_FLIP and DDSCAPS_FRONTBUFFER capabilities. The display memory previously associated with the front buffer is associated with the back buffer.
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.
IDirectDrawSurface::Flip will not be synchronized with the vertical blank by default. Use DDFLIP_WAITVSYNC to override this behavior.
|Windows Embedded CE||Windows Embedded CE 6.0 and later|
|Windows Mobile||Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later|