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?
Th开发者_开发知识库anks
Update: I also need the monitors type too, but this can be read from EDID too somehow
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.
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
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.
精彩评论