4

Does anyone know how to get the connected monitors serial number in C or C++? I found some code, but they are written in vbs which i don't understand. I need some example code written in C or C++. I know that the serial numbers are read from EDID but unfortunately i don't know how :( Could someone help me?

Thanks

Update: I also need the monitors type too, but this can be read from EDID too somehow

kampi
  • 2,362
  • 12
  • 52
  • 91
  • It may help to post a link to the code you found in VBScript – Justin Sep 01 '11 at 10:50
  • @Justin: Here you find it http://forum.bigfix.com/viewtopic.php?id=1552 – kampi Sep 01 '11 at 11:01
  • Essentially that code reads the `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY` keys and matches them against WMI data (HKLM also contains EDID data for monitors that were connected in the past). You could probably get the connected info from the SetupAPI as well (class Monitors) – MSalters Sep 01 '11 at 11:58

3 Answers3

2

Here is a link to hopefully more readable VB code. What he's basically doing is looking in the registry where windows stored the EDID data of the monitor. It is located at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\DISPLAY\...\Device Parameters

In the wikipedia article you can find information about the EDID format

2

It isn't exactly what you are looking for, but a good starting point should be GetMonitorInfo

I think digging some more in the msdn pages should give you everything you need. MSDN is actually a great place to look for C/C++ Windows API functions.

daramarak
  • 6,115
  • 1
  • 31
  • 50
0

This DisplayDetails.GetMonitorDetails() code worked great for me. I found in my testing that Dell monitors reliably returned S/N information, however all non-Dell displays I tried (3 other brands) did not.

holtavolt
  • 4,378
  • 1
  • 26
  • 40