Microsoft DirectX 9.0

IDirectDraw::EnumDisplayModes

The EnumDisplayModes method 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.

Syntax

HRESULT EnumDisplayModes(
  DWORD dwFlags,
  LPDDSURFACEDESC lpDDSurfaceDesc,
  LPVOID lpContext,
  LPDDENUMMODESCALLBACK lpEnumCallback
  );

Parameters

dwFlags

Reserved. Must be zero.

lpDDSurfaceDesc

Points to a DDSURFACEDESC structure to be checked against available modes. If NULL, all modes will be enumerated.

lpContext

A user-defined pointer that will be passed to the callback function each time a mode 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 to an invalid 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(PDDMODDESC lpDDModeDesc, LPVOID lpContext);

The lpDDModeDesc parameter points to a DDMODEDESC structure describing a mode that provides the necessary functionality. This data is read-only.

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