Microsoft DirectX 9.0


The GetAttachedSurface method finds the attached surface that has the specified capabilities. Attachments are used to connect multiple DirectDrawSurface objects into complex structures like the ones needed to support 3-D page flipping with Z buffers. GetAttachedSurface will fail if there is more than one surface attached which matches the capabilities requested. In this case the application must use EnumAttachedSurfaces to obtain the non-unique attached surfaces.


HRESULT GetAttachedSurface(



Points to a DDCAPS structure that contains the hardware capabilities of the surface.


Points to a pointer that will be filled with the address of the DIRECTDRAWSURFACE that is attached to the requesting surface and has the appropriate capabilities.

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_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_NOTFOUND Requested item was not found.

See Also