Microsoft DirectX 9.0

IDirectDraw::DuplicateSurface

The DuplicateSurface method creates a new DirectDrawSurface object which points to the same surface memory as an existing DirectDrawSurface object. This duplicate can be used just like the original. The surface memory will be released when the last object referencing it is released. The primary surface, 3-D surfaces, or implicitly created surfaces cannot be duplicated.

Syntax

HRESULT DuplicateSurface(
  LPDIRECTDRAWSURFACE lpDDSurface,
  LPLPDIRECTDRAWSURFACE lplpDupDDSurface
  );

Parameters

lpDDSurface

Points to the IDirectDrawSurface interface on the surface to be duplicated.

lplpDupDDSurface

Address of a variable to receive the IDirectDrawSurface interface of the new surface.

Return Values

Value Description
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_SURFACELOST Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.
DDERR_OUTOFMEMORY DirectDraw does not have enough memory to perform the operation.
DDERR_CANTDUPLICATE Can't duplicate primary and 3-D surfaces, or surfaces that are implicitly created.
DD_OK The method succeeded.

See Also