How to identify monitor or projector connect to pc?
Asked Answered
A

0

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?

Abrogate answered 17/1, 2017 at 3:32 Comment(8)
Maybe this answer might be relevant for you https://mcmap.net/q/387334/-find-number-and-resolution-to-all-monitorsTarsus
You might have to query the WMI system to get it. The WMI objects listed here might be of use. blogs.technet.microsoft.com/heyscriptingguy/2013/10/03/…Tungusic
@BradleyUffner Which information will be used to identify these display type?Abrogate
@shash678 I try to use Screen.AllScreens, but DeviceName is only \\.\DISPLAY1 (1, 2, 3, ...). It is not enough to identify these display type.Abrogate
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 theCimSEssion 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.Tungusic
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.Tungusic
Here are the different WMI hardware classes you can query, and exactly what information they can contain. msdn.microsoft.com/en-us/library/aa394122(v=vs.85).aspx (Use the list on the left side to look at other classes)Tungusic
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.Unschooled

© 2022 - 2024 — McMap. All rights reserved.