IDirectDraw::DuplicateSurface

HRESULT DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,

LPLPDIRECTDRAWSURFACE FAR * lplpDupDDSurface);

Duplicates a DirectDrawSurface.

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

DDERR_CANTDUPLICATE DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS DDERR_OUTOFMEMORY
DDERR_SURFACELOST  

lpDDSurface

Address of the DirectDrawSurface structure to be duplicated.

lplpDupDDSurface

Address of the DirectDrawSurface pointer that points to the newly created duplicate DirectDrawSurface structure.

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