IDirectDraw::EnumSurfaces

HRESULT EnumSurfaces(DWORD dwFlags,

LPDDSURFACEDESC lpDDSD, LPVOID lpContext,

LPDDENUMSURFACESCALLBACk lpEnumCallback);

Enumerates all of the existing or possible surfaces that meet the search criterion specified.

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

DDERR_INVALIDOBJECT DDERR_INVALIDPARAMS

dwFlags

DDENUMSURFACES_ALL

Enumerates all of the surfaces that meet the search criterion.

DDENUMSURFACES_MATCH

Searches for any surface that matches the surface description.

DDENUMSURFACES_NOMATCH

Searches for any surface that does not match the surface description.

DDENUMSURFACES_CANBECREATED

Enumerates the first surface that can be created that meets the search criterion.

DDENUMSURFACES_DOESEXIST

Enumerates the already existing surfaces that meet the search criterion.

lplpDDSD

Address of a DDSURFACEDESC structure that defines the surface of interest.

lpContext

Address of a caller-defined structure to be passed to each enumeration member.

lpEnumCallback

Address of the EnumCallback function the enumeration procedure will call every time a match is found.

If the DDENUMSURFACES_CANBECREATED flag is set, this method will attempt to temporarily create a surface that meets the criteria. Note that as a surface is enumerated, its reference count is increased—if you are not going to use the surface, use IDirectDraw::Release to release the surface after each enumeration.