Programmatically override the High DPI awareness

旧巷老猫 提交于 2019-12-23 00:42:33

问题


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.


回答1:


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.




回答2:


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:


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



来源:https://stackoverflow.com/questions/49333034/programmatically-override-the-high-dpi-awareness

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!