wangcd
wangcd

Reputation: 21

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:

image

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

Answers (3)

YangXiaoPo-MSFT
YangXiaoPo-MSFT

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

Anders
Anders

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

Chris G.
Chris G.

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

Related Questions