Share via


Determining Supported Display Modes (Windows Embedded CE 6.0)

1/6/2010

Because display hardware varies, not all devices will support all display modes. To determine the display modes supported on a given system, call the IDirectDraw::EnumDisplayModes method.

By setting the appropriate values and flags, the EnumDisplayModes method can list all supported display modes or confirm that a single display mode that you specify is supported.

The method's first parameter, dwFlags, controls extra options for the method; in most cases, you will set dwFlags to 0 to ignore extra options.

The second parameter, lpDDSurfaceDesc, is the address of a DDSURFACEDESC structure that describes a given display mode to be confirmed; you will usually set this parameter to NULL to request that all modes be listed.

The third parameter, lpContext, is a pointer that you want DirectDraw to pass to your callback function; if you do not need any extra data in the callback function, use NULL here.

Last, you set the lpEnumModesCallback parameter to the address of the callback function that DirectDraw will call for each supported mode.

The callback function you supply when calling EnumDisplayModes must match the prototype for the EnumModesCallback function.

For each display mode that the hardware supports, DirectDraw calls your callback function passing two parameters.

The first parameter is the address of a DDSURFACEDESC structure that describes one supported display mode, and the second parameter is the address of the application-defined data you specified when calling EnumDisplayModes, if any.

Examine the values in the DDSURFACEDESC structure to determine the display mode it describes. The key structure members are the dwWidth, dwHeight, and ddpfPixelFormat members.

The dwWidth and dwHeight members describe the display mode's dimensions, and the ddpfPixelFormat member is a DDPIXELFORMAT structure that contains information about the mode's bit depth.

The DDPIXELFORMAT structure carries information describing the mode's bit depth and tells you whether or not the display mode uses a palette.

If dwFlags contains DDPF_RGB, then the display mode is non-palettized and its bit depth is provided in the dwRGBBitCount member of the DDPIXELFORMAT structure.

See Also

Concepts

Display Modes