Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I retrieve monitor information?

I am trying to retrieve the monitor ID's as shown in the Windows display properties (#1, 2... etc), but I can't seem to find a way. I have tried using EnumDisplayMonitors as well as EnumDisplayDevices. They both return something like "\.\DISPLAY1". However, this number doesn't always match the number shown by Windows, especially when 2 video cards are being used to drive 3 or more monitors. Is there an API call I am missing to retrieve this information, or is there a way to get it from the registry or somewhere else? Thanks!

I have tried these methods:
Win32: EnumDisplayMonitors, EnumDisplayDevices: Neither of these return monitors that aren't active, and neither one returns the correct IDs.
WMI: "select * from Win32_DesktopMonitor" doesn't return all the monitors, and there is no ID.
Registry: I have found the monitors in various locations, none of the places I found have the info I am looking for.

Any help is much appreciated. :)

Update: These are the monitor numbers I am looking for: alt text

like image 257
Jon Tackabury Avatar asked Apr 08 '10 13:04

Jon Tackabury


People also ask

Do display monitors store information?

Can Monitors Store Data? The short answer is yes, monitors often have a minor implementation to store data for menial purposes. However, this does not mean that it can store personal data from the machine itself, so it doesn't present itself as a vulnerability to your cybersecurity.

Can you get monitor serial number from PC?

Type cmd in the Windows search bar at the bottom-left of the screen, then select Command Prompt from the list of results. In the Command Prompt window, type wmic bios get serialnumber and press Enter.

How do I find my monitor serial number?

The monitors and LCD displays have the serial number on a sticker attached to the back of the monitor. The serial number sticker is generally located in the vicinity of the power or video cord. Some monitors have a serial number only within the On Screen Display (OSD) and some have both physical and OSD.


2 Answers

Depending on the purpose, you might want to look toward a driver-based solution. I know nVidia have some decent libs that gives you access to most of the functions un the control pannel.

like image 178
Phillaf Avatar answered Oct 19 '22 22:10

Phillaf


Did you make two calls to EnumDisplayDevices? Try something like:

while (EnumDisplayDevices(0, dev, &dd, 0))
{
...
  while (EnumDisplayDevices(dd.DeviceName, devMon, &ddMon, 0))
  {
   ...
  }
}
like image 21
VitalyVal Avatar answered Oct 20 '22 00:10

VitalyVal