MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.26k stars 149 forks source link

Windows GUI: Use older API for getting system DPI, update2 #861

Closed cjee21 closed 4 weeks ago

cjee21 commented 4 weeks ago

Implement delayed loading of user32.dll and use GetDpiForWindow. Should work on Windows 7 to 11 now.

Tested on Windows 7 VM at 100% and 125% Tested on Windows 11 PC at 100% and 150%

Nothing unexpected noticed, all seems fine.

cjee21 commented 4 weeks ago

🤔 maybe should use GetDpiForWindow instead

cjee21 commented 4 weeks ago

Changed to GetDpiForWindow. Still works fine. Now new API works on Windows 10 Anniversary Update onwards.

JeromeMartinez commented 4 weeks ago

I was not aware of ILINK_DelayLoadDll, I was implementing the dynamic load myself but this method is better. GetDpiForWindow how many API is there for getting DPI??? :-p.

cjee21 commented 4 weeks ago

how many API is there for getting DPI??? :-p.

Many... https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-reference

JeromeMartinez commented 4 weeks ago

Many...

😱

JeromeMartinez commented 4 weeks ago

Side note: I was "flooded" (ok, not so much, but still a couple within a couple of hours) by emails / reports about Win7 despite its EOL for several years, so Win7 support is still important. (Me remembering some complains when we stopped WinXP support due to new Visual Studio not supporting it anymore few years ago so several years after its end of life... We'll have to support Win7 for several years)