views:

36

answers:

1

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 properties 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.

+2  A: 

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.

Hans Passant
Thanks for your answer. As noted in my edit to the question it has helped me to find a duplicate question and set of answers that should help with what I want. The question never appeared despite all the searching I did.
RobS