Reputation: 41718
I have a MFC app that has default MFC DPI support: it is high DPI aware, but not per-monitor DPI aware. Windows 10 version 1703 added support for System (enhanced) DPI scaling. I enabled this mode from Windows Explorer in the .exe compatibility settings, and it works for my app.
Ideally, I'd make the app fully multi-monitor DPI compliant, but that's a fair amount of work. So instead, I want to tell the OS to use system (enhanced) DPI scaling for my app, if the OS supports it.
Does the applications's manifest enable this, and if so, what needs to be added or changed?
Additionally, how do I modify the manifest? Currently, I'm using the default Visual Studio 2017 MFC project structure, which doesn't have a manifest file in my project. Instead, the manifest's contents are specified as project properties, and the manifest is generated with mt.exe. Can I inject a change with mt.exe? If I need to replace the manifest with a custom one, what's the easiest way?
Upvotes: 9
Views: 3884
Reputation: 41718
Add the gdiScaling setting to your application's manifest to tell Windows to apply GDI scaling on all monitors.
GdiScaling.manifest
in your project.<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>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
GdiScaling.manifest
. This will merge your GDI scaling settings into the rest of the generated manifest.When you build, you will get a warning about Microsoft not having its act together, but you already knew that. :-) The exact text of the warning is this:
GdiScaling.manifest : manifest authoring warning 81010002: Unrecognized Element "gdiScaling" in namespace "http://schemas.microsoft.com/SMI/2017/WindowsSettings".
Fortunately, Windows doesn't care and recognizes the setting anyway.
Upvotes: 14