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 obtains information about the display devices in a system.

Syntax

BOOL EnumDisplayDevices(
  LPCTSTR 
lpDevice, 
  DWORD 
iDevNum, 
  PDISPLAY_DEVICE 
lpDisplayDevice, 
  DWORD 
dwFlags 
);

Parameters

lpDevice

[in] Pointer to the device name.

If NULL, the function returns information for the display devices in the system, based on iDevNum.

For more information, see Remarks.

iDevNum

[in] Index value that specifies the display device of interest.

The operating system identifies each display device with an index value.

The index values are consecutive integers, starting at 0.

If a system has three display devices, for example, they are specified by the index values 0, 1, and 2.

lpDisplayDevice

[out] Pointer to a DISPLAY_DEVICEstructure that receives information about the display device specified by iDevNum.

Before calling EnumDisplayDevices, you must initialize the cbmember of DISPLAY_DEVICEto the size, in bytes, of DISPLAY_DEVICE.

dwFlags

[in] Set this parameter to zero.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

The function fails if iDevNumis greater than the largest device index.

Remarks

To query all display devices in the system, call this function in a loop, starting with iDevNumset to 0, and incrementing iDevNumuntil the function fails.

To select all display devices in the desktop, use only the display devices that have the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP flag in the DISPLAY_DEVICEstructure.

To get information about the display device, call EnumDisplayDeviceswith lpDeviceset to NULL. For example, DISPLAY_DEVICE.DeviceStringcontains the device name.

To obtain information about a display monitor, first call EnumDisplayDeviceswith lpDeviceset to NULL. The device name is returned in lpDisplayDevice. Use this value in lpDeviceand set iDevNumto zero in a second call to EnumDisplayDevices. DISPLAY_DEVICE.DeviceStringsubsequently returns the monitor name.

EnumDisplayDevicesassumes that there is only one monitor per display device. It cannot obtain information for multiple monitors attached to a single display device. This behavior differs from Windows-based desktop platforms.

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