Search code examples
c++winapiwindows-7dpidpi-aware

GetProcessDpiAwareness() prior to Windows 8


I know that I can use GetProcessDpiAwareness() to check the dpi awareness of a particular process. However this is only supported from Windows 8.1 upwards. Is there any way to query the dpi awareness of a process prior to that? I couldn't find any information about it.

Particularly I want to know if the process was ran with [x] Disable display scaling on high DPI settings (which was available at least from Windows 7.


Solution

  • When you check the "Disable display scaling on high DPI settings" checkbox on Windows 7 (and 8) that setting is stored in the registry, by creating a key the name of which is the fully qualified path to the executable under HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers and the content of which is:

    • HIGHDPIAWARE to enable display scaling
    • ~ HIGHDPIAWARE to explicitly disable display scaling

    So you could simply look up that registry key to see whether display scaling was enabled or disabled for the process.