This function obtains information about the display devices in a system.
BOOL EnumDisplayDevices( LPCTSTR lpDevice, DWORD iDevNum, PDISPLAY_DEVICE lpDisplayDevice, DWORD dwFlags );
[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.
[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.
[out] Pointer to a DISPLAY_DEVICE structure that receives information about the display device specified by iDevNum.
Before calling EnumDisplayDevices, you must initialize the cb member of DISPLAY_DEVICE to the size, in bytes, of DISPLAY_DEVICE.
[in] Set this parameter to zero.
To query all display devices in the system, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until 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_DEVICE structure.
To get information about the display device, call EnumDisplayDevices with lpDevice set to NULL. For example, DISPLAY_DEVICE.DeviceString contains the device name.
To obtain information about a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. The device name is returned in lpDisplayDevice. Use this value in lpDevice and set iDevNum to zero in a second call to EnumDisplayDevices. DISPLAY_DEVICE.DeviceString subsequently returns the monitor name.
EnumDisplayDevices assumes 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.