Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting "Override high DPI scaling" to "System (Enhanced)" programmatically or with a manifest (MinGW)

I tried all possible combinations of gdiScaling and dpiAware, still no luck.

If I manually right click app.exe and set "Override high DPI scaling" to "System (Enhanced)", it works great.

<assembly xmlns="urn:schemas-microsoft-com:asm.v1"  xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">
      <gdiScaling>true</gdiScaling>
      <dpiAware>False</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>

</assembly>
like image 771
Alex Avatar asked Oct 12 '25 05:10

Alex


1 Answers

Try this manifest:

<asmv3:application>
   <asmv3:windowsSettings>
        <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>
        <gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
   </asmv3:windowsSettings>
</asmv3:application>

it is ripped from MMC.exe of Windows 10 1809 which hosts device manager and this must work:

The Microsoft Management Console (mmc.exe) will be GDI scaled, by default, in the Creators Update. This means that many in-box Windows snap ins, such as Device Manager, will benefit from this feature in the Creators Update.

If this also doesn't work, enable it via code with SetProcessDpiAwarenessContext function and DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALEDwhich is defined in "Include\10.0.BUILDNUMBER.0\shared\windef.h" as

#define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED    ((DPI_AWARENESS_CONTEXT)-5)
like image 98
magicandre1981 Avatar answered Oct 14 '25 20:10

magicandre1981