Microsoft DirectX 9.0


The DeleteAttachedSurfaces method detaches two attached surfaces. The detached surface is not released.

If NULL is passed as the surface to be detached, all attached surfaces will be detached. Implicit attachments (those formed by DirectDraw, rather than AddAttachedSurface) cannot be detached. Detaching surfaces from a flippable chain can change other surfaces in the chain. If a front buffer is detached from a flippable chain, the next surface in the chain becomes the front buffer and the surface following it 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 flippable chain only has two surfaces and they are detached, the flippable chain is destroyed and both surfaces return to their previous designations.


HRESULT DeleteAttachedSurfaces(
  DWORD dwFlags,



Reserved. Must be zero.


Points to the IDirectDrawSurface interface of the surface to be detached. If NULL is passed, all attached surfaces will be detached.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
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_SURFACENOTATTACHED The surface is not attached to a DirectDraw object.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_CANNOTDETACHSURFACE This surface can not be detached from the requested surface.

See Also