Microsoft DirectX 9.0 |
The EnumSurfaces method enumerates all of the existing or possible surfaces that meet the search criterion specified. If the DDENUMSURFACES_CANBECREATED flag is set, then 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, release the surface after each enumeration.
Syntax
HRESULT EnumSurfaces(
DWORD dwFlags,
LPDDSURFACEDESC lpDDSD,
LPVOID lpContext,
LPDDENUMSURFACESCALLBACK lpEnumCallback
);
Parameters
dwFlags
May be one of the following values.
Value | Description |
DDENUMSURFACES_ALL | Enumerates all of the surfaces that meet the search criterion. |
DDENUMSURFACES_MATCH | A search hit is a surface that matches the surface description. |
DDENUMSURFACES_NOMATCH | A search hit is a surface that does not match the surface description. |
DDENUMSURFACES_CANBECREATED | Enumerates the first surface that can be created which meets the search criterion. |
DDENUMSURFACES_DOESEXIST | Enumerates the surfaces that already exist that meet the search criterion. |
lpDDSD
A pointer to a DDSURFACEDESC structure defining the surface of interest.
lpContext
A user-defined pointer that will be passed to the callback function each time a surface is enumerated.
lpEnumCallback
Points to the user-defined function the enumeration procedure will call for each mode enumerated. See Remarks.
Return Values
Value | Description |
DD_OK | The method succeeded. |
DDERR_INVALIDOBJECT | DirectDraw received a pointer that was an invalid DirectDraw object. |
DDERR_INVALIDPARAMS | One or more of the input parameters is invalid. |
Remarks
The callback function passed as lpEnumCallback must have the following syntax:
HRESULT EnumCallback(LPDIRECTDRAWSURFACE lpDDSurface, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext)
If existing surfaces are being enumerated (DDENUMSURFACES_DOESEXIST), The lpDDSurface parameter points to the DirectDrawSurface currently being enumerated. If a potential surface is being enumerated (DDENUMSURFACES_CANBECREATED), then the value is NULL.
The lpDDSurfaceDesc parameter points to the DDSURFACEDESC structure for the existing or potential surface that most closely matches the requested surface.
The lpContext parameter contains the value that was passed in the lpContext parameter of EnumDisplayModes.
The callback function should return one of the following values:
Value | Description |
DDENUMRET_OK | Continue the enumeration. |
DDENUMRET_CANCEL | Stop the enumeration. |
See Also