0

I am writing a small C# application to identify which type of display connect to pc

  1. A Monitor
  2. A TV screen
  3. A projector

I try to do with

Screen.AllScreens
EnumDisplayDevices()

but it does not help anything.

When I use

var mbs = new ManagementObjectSearcher("Select * From CIM_LogicalDevice");
ManagementObjectCollection mbsList = mbs.Get();

I can get device id:

DISPLAY\OTMFB0E\4&9C24ACE&0&UID16843008
DISPLAY\DELD058\4&9C24ACE&0&UID50725632

But there is not any value which is used to identify between a normal monitor and a projector.

Is there any way to do? Or which information will be different of these display types?

GSP
  • 574
  • 3
  • 7
  • 34
  • 1
    Maybe this answer might be relevant for you http://stackoverflow.com/a/1538620/6328256 – Sash Sinha Jan 17 '17 at 03:37
  • 1
    You might have to query the WMI system to get it. The WMI objects listed here might be of use. https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/use-powershell-to-discover-multi-monitor-information/ – Bradley Uffner Jan 17 '17 at 03:38
  • @BradleyUffner Which information will be used to identify these display type? – GSP Jan 17 '17 at 03:40
  • @shash678 I try to use Screen.AllScreens, but DeviceName is only \\.\DISPLAY1 (1, 2, 3, ...). It is not enough to identify these display type. – GSP Jan 17 '17 at 03:42
  • 2
    That link shows powershell commands, but those commands contain the WMI object to query, such as `Win32_Desktopmonitor`, or `WmiMonitorBasicDisplayParams`. You would need to use the`CimSEssion` and `CimInstance` classes in the `Microsoft.Management.Infrastructure` namespace to access them. This isn't something I've done before, so I can't really give you specifics. – Bradley Uffner Jan 17 '17 at 03:42
  • 2
    There is also no guarantee that those objects will contain the information you want. It's up to the monitor manufacturer (and video card) as to what information to present. The link I gave you has some example of what kind of information it can return. – Bradley Uffner Jan 17 '17 at 03:43
  • 1
    Here are the different WMI hardware classes you can query, and exactly what information they can contain. https://msdn.microsoft.com/en-us/library/aa394122(v=vs.85).aspx (Use the list on the left side to look at other classes) – Bradley Uffner Jan 17 '17 at 03:45
  • 1
    Also, bear in mind that a "logical" monitor may in fact be being displayed through multiple means - e.g. a laptop connected to a projector may continue to show the same images on its built-in screen as those it is projecting. – Damien_The_Unbeliever Jan 17 '17 at 10:27

0 Answers0