'how to get a list of available monitors in windows 10
I want to get a list of available monitors in Windows 10, same as the monitor list shown in the System display settings (no matter whether they are attached or unattached), just like this:
I use EnumDisplayDevices() to enumerate all displays, but there is no proper flag indicating whether the display is available.
So, how can I do this?
Solution 1:[1]
EnumDisplayDevices appears to return pseudo-devices too.
According to EnumDisplayMonitors documentation you can use GetSystemMetrics (SM_CMONITORS) to filter out pseudo devices and receive a list of physical devices only.
Potentially a similar question how to list available monitors in c++ windows 7? helps you too.
Solution 2:[2]
EnumDisplayDevices gives you the DISPLAY_DEVICE_ATTACHED_TO_DESKTOP and DISPLAY_DEVICE_MIRRORING_DRIVER flags. MONITORINFOEX gives you the device name to compare with when mapping from HMONITOR.
Solution 3:[3]
The QueryDisplayConfig function retrieves information about all possible display paths for all display devices, or views, in the current setting. You can try the document example.
More information.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Anders |
| Solution 3 |

