Platform SDK: DirectX

IDirectDrawSurface7::AddAttachedSurface

The IDirectDrawSurface7::AddAttachedSurface method attaches the specified z-buffer surface to this surface.

HRESULT AddAttachedSurface( 
  LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface  
);

Parameters

lpDDSAttachedSurface
Address of an IDirectDrawSurface7 interface that the surface is to be attached to.

Return Values

If the method succeeds, the return value is DD_OK.

If it fails, the method can return one of the following error values:

DDERR_CANNOTATTACHSURFACE
DDERR_GENERIC
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_SURFACEALREADYATTACHED
DDERR_SURFACELOST
DDERR_WASSTILLDRAWING

Remarks

This method increments the reference count of the surface being attached. You can explicitly unattach the surface and decrement its reference count by using the IDirectDrawSurface7::DeleteAttachedSurface method. Unlike complex surfaces that you create with a single call to IDirectDraw7::CreateSurface, surfaces attached with this method are not automatically released. It is the application's responsibility to release such surfaces.

You can attach only z-buffer surfaces with this method.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 98.
  Header: Declared in ddraw.h.

See Also

IDirectDrawSurface7::DeleteAttachedSurface, IDirectDrawSurface7::EnumAttachedSurfaces