Group: Device Context - Library: user32
How to change display settings: screen resolution, screen refresh rate
How to detect if additional monitor is connected and active
BOOL EnumDisplayDevices(
LPCTSTR lpDevice, // device name
DWORD iDevNum, // display device
PDISPLAY_DEVICE lpDisplayDevice, // device information
DWORD dwFlags // reserved
);
DECLARE INTEGER EnumDisplayDevices IN user32;
STRING lpDevice,;
INTEGER iDevNum,;
STRING @ lpDisplayDevice,;
INTEGER dwFlags
lpDevice [in] Pointer to the device name. If NULL, function returns information for the display adapter(s) on the machine, based on iDevNum.
iDevNum [in] Index value that specifies the display device of interest.
lpDisplayDevice [out] Pointer to a DISPLAY_DEVICE structure that receives information about the display device specified by iDevNum.
dwFlags This parameter is currently not used and should be set to zero.
If the function succeeds, the return value is nonzero.
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 get information on the display adapter, call EnumDisplayDevices with lpDevice set to NULL. Then DISPLAY_DEVICE.DeviceString contains the adapter name.
To obtain information on a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. Then call EnumDisplayDevices with lpDevice set to DISPLAY_DEVICE.DeviceName from the first call to EnumDisplayDevices and with iDevNum set to zero. Then DISPLAY_DEVICE.DeviceString is the monitor name.
See also MonitorFromWindow, GetMonitorInfo, EnumDisplaySettings functions.