问题
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
回答1:
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.
回答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
回答3:
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.
来源:https://stackoverflow.com/questions/7269216/how-to-get-monitor-serial-number