Search code examples
c++windowswinapidpi

Setting DPI awareness level dynamically in win32 Application


I am looking for any method for setting DPI awareness level on fly(based on user input). I came across this.

It suggests that I should use setProcessDpiAwareness function to set the awareness level. But This api call is supported from windows 8.1 preview only. Is there any other method I can use to set the Dpi awareness level dynamically which is supported from windows 7 onwards?

Thanks in advance.


Solution

  • Before the advent of per-monitor DPI awareness in Windows 8.1, there is SetProcessDPIAware, supported from Vista up.

    However, it strikes me as very unusual that you might wish to take this decision at runtime. Best practise is that the application is designed to be high DPI aware and that awareness is written into the application manifest.