IDirectDrawSurface2::AddAttachedSurface

HRESULT AddAttachedSurface(

LPDIRECTDRAWSURFACE2 lpDDSAttachedSurface);

Attaches a surface to another surface.

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

DDERR_CANNOTATTACHSURFACE

DDERR_GENERIC

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_SURFACEALREADYATTACHED

DDERR_SURFACELOST

DDERR_WASSTILLDRAWING

lpDDSAttachedSurface

Address of the DirectDraw surface that is to be attached.

Possible attachments include z-buffers, alpha channels, and back buffers. Some attachments automatically break other attachments. For example, the 3D z-buffer can be attached only to one back buffer at a time. Attachment is not bidirectional, and a surface cannot be attached to itself. Emulated surfaces (in system memory) cannot be attached to non-emulated surfaces. Unless one surface is a texture map, the two attached surfaces must be the same size. A flipping surface cannot be attached to another flipping surface of the same type; however, attaching two surfaces of different types is allowed. For example, a flipping z-buffer can be attached to a regular flipping surface. If a non-flipping surface is attached to another non-flipping surface of the same type, the two surfaces will become a flipping chain. If a non-flipping surface is attached to a flipping surface, it becomes part of the existing flipping chain. Additional surfaces can be added to this chain, and each call of the IDirectDrawSurface2::Flip method will advance one step through the surfaces.