How to use manifest to control disable DPI scaling and compatibility

三世轮回 提交于 2019-12-12 04:32:01

问题


I have a manifest file and use the mt command in makefile to add it into one of my exe files. After it's installed. If I use DPI Awareness Enabler or check the registry in HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers, it does NOT show anything interesting. Normally if I manually set Compatibility to Windows 7 and disable DPI scaling in file property, it would show up in DPI Awareness Enabler and the registry.

So am I right to assume register is linked only to GUI not the actual file? As if I use mt command to extract manifest file from exe, I can see my original manifest file.

Above all, I don't think my manifest file works as expected. The way I test it is to reproduce a bug in the app. The workaround is set Compatibility to Windows 7 and disable DPI scaling in file property. If I just use the installed file even with manifest file embeded, it doesn't solve the problem. But if I manually change it in property, it solves the bug.

Some extra information, the app is built with VS2010 with hotfix to fix the manifest warning. Not sure if that is the cause.

Any help would be appreciated.

Here is the manifest file

<?xml version="1.0" encoding="UTF-8"?>
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
   <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
     <application>
       <!-- Windows 7 -->
       <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
     </application>
   </compatibility>
   <asmv3:application>
     <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
       <dpiAware>true</dpiAware>
     </asmv3:windowsSettings>
   </asmv3:application>
 </assembly>

Here is the part in Makefile

    ADD_CUSTOM_COMMAND(
        TARGET myExe
        POST_BUILD
        COMMAND "mt.exe" -manifest \"${CMAKE_SOURCE_DIR}\\res\\dpiaware.manifest\" -inputresource:\"$<TARGET_FILE:myExe>\"\;\#1 -outputresource:\"$<TARGET_FILE:myExe>\"\;\#1
        COMMENT "Adding display aware manifest..."
    )

回答1:


Ok, I finally give up on the manifest solution. Just so happen we use wix. So I add some registry values to HKLM->SOFTWARE->Microsoft->Windows NT->CurrentVersion->AppCompatFlags->Layers during installation.



来源:https://stackoverflow.com/questions/40242748/how-to-use-manifest-to-control-disable-dpi-scaling-and-compatibility

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