开发者

Determining which monitors/displays/screens are attached

开发者 https://www.devze.com 2023-01-07 17:43 出处:网络
In the windows desktop properties all the displays are shown and are indicated to be active or inactive. My graphics card has a monitor connected to the dvi port but not the vga and this is correctly

In the windows desktop properties all the displays are shown and are indicated to be active or inactive. My graphics card has a monitor connected to the dvi port but not the vga and this is correctly determined (i.e. one of the displays is labelled inactive). I also have a usb displaylink lcd which is also detected.

Using system.windows.forms.screen.allscreens I am able to enumerate all the possible displays (in this case, 3) on my system but I am unable to determine which ones are active (i.e. actually have a device connected to them). Is this possible in .net?

None of the proper开发者_如何学运维ties of system.windows.forms.screen seem to have this information.

EDIT: Noted that my question is actually a duplicate of this question but I only found it after Hans Passant directed me to looking at WMI.


No, it cannot see disabled screens. You'd have to use a low-level hardware query, the kind that are supported by WMI and the System.Management class. I'd guess at Win32_VideoController, Availability member. Use the WMI Code Creator tool to experiment with the query and get the code you want to use in your program.

0

精彩评论

暂无评论...
验证码 换一张
取 消