Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function retrieves information about one of the graphics modes for a display device. To retrieve information for all the graphics modes of a display device, make a series of calls to this function.

Syntax

BOOL EnumDisplaySettings(
  LPCTSTR 
lpszDeviceName,
  DWORD 
iModeNum,
  LPDEVMODE 
lpDevMode
);

Parameters

lpszDeviceName

[in] Pointer to a null-terminated string that specifies the display device.

This parameter is either NULL or a DISPLAY_DEVICE.DeviceNamereturned from EnumDisplayDevices.

A NULL value specifies the current display device on the system that is running the calling thread.

iModeNum

[in] Specifies the type of information to retrieve.

This value can be a graphics mode index or one of values shown in the following table.

Value Description

ENUM_CURRENT_SETTINGS

Retrieve the current settings for the display device.

ENUM_REGISTRY_SETTINGS

Retrieve the settings for the display devices that are currently stored in the registry.

For more information, see Remarks.

lpDevMode

[out] Pointer to a DEVMODEstructure that will contain the information about the specified graphics mode.

Before calling EnumDisplaySettings, set the dmSizemember to sizeof(DEVMODE), and set the dmDriverExtramember to indicate the size, in bytes, of the additional space available to receive private driver data.

The EnumDisplaySettingsfunction sets values for the following DEVMODEmembers:

dmBitsPerPel

dmPelsWidth

dmPelsHeight

dmDisplayFlags

dmDisplayFrequency

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

To get extended error information, call GetLastError.

Remarks

The function fails if iModeNumis greater than the index of the display device's last graphics mode.

You can use iModeNumto enumerate all of a display device's graphics modes.

Graphics mode indexes start at zero.

To obtain information for all of a display device's graphics modes, make a series of calls to EnumDisplaySettings. To do this, set iModeNumto zero for the first call and then increment iModeNumby one for each subsequent call. Continue calling the function until the return value is zero.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.2 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also