The IDirectDrawSurface4::DeleteAttachedSurface method detaches two attached surfaces.
HRESULT DeleteAttachedSurface(
DWORD dwFlags,
LPDIRECTDRAWSURFACE4 lpDDSAttachedSurface
);
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:
DDERR_CANNOTDETACHSURFACE |
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
DDERR_SURFACELOST |
DDERR_SURFACENOTATTACHED |
This method decrements the reference count of the surface being detached. If the reference count of the surface being detached reaches zero, it is lost and removed from memory.
Implicit attachments, those formed by DirectDraw rather than the IDirectDrawSurface4::AddAttachedSurface method, cannot be detached. Detaching surfaces from a flipping chain can alter other surfaces in the chain. If a front buffer is detached from a flipping chain, the next surface in the chain becomes the front buffer, and the following surface becomes the back buffer. If a back buffer is detached from a chain, the following surface becomes a back buffer. If a plain surface is detached from a chain, the chain simply becomes shorter. If a flipping chain has only two surfaces and they are detached, the chain is destroyed and both surfaces return to their previous designations.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in ddraw.h.
Import Library: Use ddraw.lib.