📜 ⬆️ ⬇️

Long live fragrant soap, or how to fix improper scaling of Windows programs

It is no secret that the introduction of high-resolution screens is faster than the adaptation of Windows programs for them. Problems arise primarily when we are tired of straining our eyes and using magnifying glasses, and we change the scaling of the system. Programs can be divided into three categories according to how they behave in this:

The most annoying option for the user is of course the second. It can not only make the program inconvenient for use, but also generally make using impossible.
Below, I will show with an example of QTIPlot how to fix it.

QTIPlot is a program whose main function (as the name implies) is the construction of graphs. It also uses Qt, which tells the operating system that it can scale itself. But unfortunately something goes wrong and as a result, the graphics created and carefully aligned on the system with scaling, lose all their harmony if they are opened on the system without scaling - the fonts begin to spread, etc. This program seems to be open source (although it is necessary to have some detective skills to find its code), but with a swoop I could not fix it. Therefore, I interpreted that it is better to live with a zamylennogo interface than to look for a replacement program, and decided to force the program to tell Windows that it does not know how to scale.

To do this, create a manifest file in the directory where the exe file that we want to change is located with the following content:
qtiplot.exe.manifest
<?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <assemblyIdentity version="1.0.0.0" name="MyApplication.app" /> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> <applicationRequestMinimum> <defaultAssemblyRequest permissionSetReference="Custom" /> <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" /> </applicationRequestMinimum> </security> </trustInfo> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> </application> </compatibility> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>false</dpiAware> </asmv3:windowsSettings> </asmv3:application> </asmv1:assembly> 


(the main thing for us here is of course
 <dpiAware>false</dpiAware> 
).
After that, you need to run the “Developer Command Prompt” from the Visual Studio Tools, go to this directory and execute the command
 mt.exe -nologo -manifest qtiplot.exe.manifest -outputresource:qtiplot.exe 

(of course, “qtiplot.exe” should be replaced with the name of the exe-file that needs to be patched).
That's all, you can run the program and enjoy the warm zamylennom interface with proper scaling.

')
The nice bonus of these dances with the manifesto is that even those programs for which we do not have the source code can be fixed this way.

PS After writing this publication, I noticed that the word "scaling" is not included in modern spelling dictionaries. I had to replace it everywhere with “scaling”. For this reason, the survey below.

Source: https://habr.com/ru/post/254211/


All Articles