IDirectDraw2::EnumSurfaces

The IDirectDraw2::EnumSurfaces method enumerates all of the existing or possible surfaces that meet the search criterion specified.

HRESULT EnumSurfaces(

DWORD dwFlags,

LPDDSURFACEDESC lpDDSD,

LPVOID lpContext,

LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback

);

Parameters

dwFlags

One of the following flags:

DDENUMSURFACES_ALL
  Enumerates all of the surfaces that meet the search criterion.
DDENUMSURFACES_CANBECREATED
  Enumerates the first surface that can be created and meets the search criterion.
DDENUMSURFACES_DOESEXIST
  Enumerates the already existing 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.

lpDDSD

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

lpContext

Address of an application-defined structure that will be passed to each enumeration member.

lpEnumSurfacesCallback

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

Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS

Remarks

If the DDENUMSURFACES_CANBECREATED flag is set, this method attempts to temporarily create a surface that meets the criterion. 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.

As part of the IDirectDraw interface, this method did not support any values other than zero for the dwFlags parameter.

QuickInfo

  Windows NT: Use version 4.0 or later.
  Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in ddraw.h.
  Import Library: Use ddraw.lib.