IDirectDraw2::EnumDisplayModes

HRESULT EnumDisplayModes(DWORD dwFlags,

LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext,

LPDDENUMMODESCALLBACK lpEnumModesCallback);

Enumerates all of the display modes the hardware exposes through the DirectDraw object that are compatible with a provided surface description. If NULL is passed for the surface description, all exposed modes will be enumerated.

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

DDERR_INVALIDOBJECT DDERR_INVALIDPARAMS

dwFlags

DDEDM_REFRESHRATES

Enumerate modes with different refresh rates. IDirectDraw2::EnumDisplayModes guarantees that a particular mode will be enumerated only once. This flag specifies whether the refresh rate is taken into account when determining if a mode is unique.

DDSD_REFRESHRATE

The dwRefreshRate member of the DDSURFACEDESC structure is valid.

lpDDSurfaceDesc

Address of a DDSURFACEDESC structure that will be checked against available modes. If the value of this parameter is NULL, all modes will be enumerated.

lpContext

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

lpEnumModesCallback

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

This method enumerates the dwRefreshRate member in the DDSURFACEDESC structure; the IDirectDraw2::EnumDisplayModes method does not contain this capability. If you use the IDirectDraw2::SetDisplayMode method to set the refresh rate of a new mode, you must use IDirectDraw2::EnumDisplayModes to enumerate the dwRefreshRate member.

To ensure COM compliance, this method is not part of the IDirectDraw interface, but belongs to the IDirectDraw2 interface. To use this method, you must first query for the IDirectDraw2 interface. For more information, see IDirectDraw2 Interface.