Reputation: 21
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?
Upvotes: 1
Views: 1867
Reputation: 2130
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.
Upvotes: 0
Reputation: 101666
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
.
Upvotes: 0
Reputation: 846
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.
Upvotes: 1