EnumDisplaySettings

 

Description

 

The EnumDisplaySettings 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.

 

C++ Syntax

 

BOOL EnumDisplaySettings(

__in LPCTSTR lpszDeviceName,

__in DWORD iModeNum,

__out LPDEVMODE lpDevMode

);

 

PowerBASIC Syntax

 

FUNCTION EnumDisplaySettings ( _

BYREF lpszDeviceName AS ASCIIZ, _

BYVAL iModeNum AS DWORD, _

BYREF lpDevMode AS DEVMODE _

) AS LONG

 

Unicode version:

 

FUNCTION EnumDisplaySettingsW ( _

BYVAL lpszDeviceName AS DWORD, _

BYVAL iModeNum AS DWORD, _

BYREF lpDevMode AS DEVMODEW _

) AS LONG

 

Parameters

 

lpszDeviceName

 

[in] Pointer to a null-terminated string that specifies the display device about whose graphics mode the function will obtain information.

 

This parameter is either NULL or a DISPLAY_DEVICE.DeviceName returned from EnumDisplayDevices. A NULL value specifies the current display device on the computer on which the calling thread is running.

 

Windows 95: lpszDeviceName must be NULL.

 

iModeNum

 

[in] Specifies the type of information to retrieve. This value can be a graphics mode index or one of the following values.

 

Value

Meaning

ENUM_CURRENT_SETTINGS

Retrieve the current settings for the display device.

ENUM_REGISTRY_SETTINGS

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

 

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, as follows: Set iModeNum to zero for the first call, and increment iModeNum by one for each subsequent call. Continue calling the function until the return value is zero.

 

When you call EnumDisplaySettings with iModeNum set to zero, the operating system initializes and caches information about the display device. When you call EnumDisplaySettings with iModeNum set to a non-zero value, the function returns the information that was cached the last time the function was called with iModeNum set to zero.

 

lpDevMode

 

[out] Pointer to a DEVMODE structure into which the function stores information about the specified graphics mode. Before calling EnumDisplaySettings, set the dmSize member to SIZEOF(DEVMODE), and set the dmDriverExtra member to indicate the size, in bytes, of the additional space available to receive private driver data.

 

The EnumDisplaySettings function sets values for the following five DEVMODE members:

 

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.

 

Windows NT/2000/XP: To get extended error information, call GetLastError.

 

Remarks

 

The function fails if iModeNum is greater than the index of the display device's last graphics mode. As noted in the description of the iModeNum parameter, you can use this behavior to enumerate all of a display device's graphics modes.

 

Windows 95/98/Me: EnumDisplaySettingsW is supported by the Microsoft Layer for Unicode.

 

Valid XHTML 1.0 Transitional