Programmatically override the High DPI awareness

4.2k Views Asked by At

There is a new option for the End User in Windows 10 Creator's Update Edition. The End User can change properties for an EXE on the compatibility tab to "Override High DPI Scaling Behavior" and set it to System (Enhanced). I tested it and it works well for some classic win32 apps.

I want to to do this by code through an API call or through the manifest. There is no information on that. Is that possible? From the comment I got, it want to clarify that this is a NEW CREATORS UPDATE FEATURE and I particularly want to know how to set the "SYSTEM (ENHANCED)" choice for override feature through manifest or code.

3

There are 3 best solutions below

0
On BEST ANSWER

I found the answer in another SO post: Enhanced system DPI scaling with VS2017

The correct clue is to investigate the new GDI Scaling manifest that is vastly improved in Creator's Update. That is used in System (Enhanced) setting.

None of the answers or comments came close. They kept referring to old articles. Moreover, someone marked the question negative:( Sad.

3
On

DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED is a now a valid DPI_AWARENESS_CONTEXT in the latest Windows 10 SDK headers (17134 as of this writing), in windef.h:

define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)

So you should call IsValidDpiAwarenessContext and SetProcessDpiAwarenessContext to take advantage of GDI Scaling at runtime, if you wish to avoid having to do this in the manifest.

This confirms that gdiScaling is mutually exclusive from Per monitor V2.

1
On

The details are covered in this blog post:

<dpiAware>True/PM</dpiAware>
<dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness>

For more details on various manifest issues, see Manifest Madness