1

Could anyone give some examples when window DPI can differ from system one? Maybe users can somehow specify from outside an application in which DPI it should run. Or maybe it's something else.

Oleksa
  • 635
  • 5
  • 15
  • 1
    DPI virtualization is practically always turned on, unless the app declares itself to be dpiAware. And yes, a desktop shortcut for a program permits overriding behavior. Compatibility tab, "Change high DPI settings" button. – Hans Passant Apr 06 '20 at 20:51

1 Answers1

1

Software can change the DPI Awareness setting(s) for windows created by a specific thread (using the SetThreadDpiAwarenessContext function), in which case a call to GetDpiForWindow for such windows will then give a (potentially) different value than a call to GetDpiForSystem.

Further, even within a given thread (or process), one can change the DPI awareness with a call to the aforementioned function, create a new window, then revert to the previous settings and create another window. Then, those two windows will have (possibly) different DPI values from each other (depending on whether or not the executable has been built with DPI awareness enabled).

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83