I need to find the βbestβ or native resolution for the connected LCD monitor under Windows (which I will then install programmatically and know how to do it.) Let me reiterate that I do not need permission from the current Windows, nor do I have to worry about CRT / projectors .
I saw how it works with this program, so I know that this is possible, despite the skeptics: http://www.entechtaiwan.com/util/moninfo.shtm
It would be better to talk directly with the monitor and request EDID information. However, I saw that it is cached in the registry and will not have a problem with extracting it from HKLM \ SYSTEM \ CurrentControlSet \ Enum \ DISPLAY, but cannot figure out how to match the data with the current main monitor.
I found this program in C: http://www.tech-archive.net/Archive/Development/microsoft.public.development.device.drivers/2004-08/0294.html and a similar python program: http: // www .koders.com / python / fid7FCCE3C908F376DC62F06CAD9B11C6D7C1CFA78F.aspx
Unfortunately, I have a lot of problems converting the C program to python, since the corresponding code does not seem to be in the win32all modules. I would try to compile it, but did not have disk space for a large compiler and have not used C for many years. I am a bit out of my element with ctypes.
My plan B will use EnumDisplaySettings () to find the highest resolution value and set it to this. On the PC I tried, it gives the correct answers, but this can be problematic.
I would prefer a solution in python, but maybe someone could help me change the program in C to spit out the resolution and compile it. Thanks in advance.
Update:
I found a potential solution. Now I read WMI to find a monitor that is available (not offline), grab its PNP device identifier and read the EDID from the registry in the subkey with the identification value. Then I parse the data for bytes 38 and 39 and compute. Not very clean, but I get results. If this is a reasonable way to do this, I will close this question, thanks.
c python windows resolution monitor
Gringo suave
source share