1

I want my program to be DPI aware but I don'T want to set the default awareness programmatically because this is not recommended according to the microsoft docs(https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process). The Enable DPI Awareness in the project configuration has no effect on the manifest or the programm itself.

What I did: I added a manifest File Added a manifest File I also enabled the DPI Awareness set Enable DPI Awareness to Yes After clear+rebuild it creates a manifest but but all I get is this manifest file without any dpi aware tags.

   <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
    <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
     <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
       <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
       </requestedPrivileges>
      </security>
     </trustInfo>
    </assembly>

I read the docs but I am not able to make it work. A manual edit won't help because the manifest is generated on build: https://learn.microsoft.com/en-us/cpp/build/understanding-manifest-generation-for-c-cpp-programs?view=vs-2019

Hope you can help. I try to answer as fast as possible. If you need more information please let me know

FelixH
  • 135
  • 1
  • 2
  • 14
  • 1
    This appears to be a bug (of sorts) in VS2017. If you can upgrade to VS2019, you'll probably have no issues but, if you can't, maybe see here (and the linked article): https://stackoverflow.com/q/46428510/10871073 – Adrian Mole Sep 29 '20 at 11:38
  • 2
    It's strange that "enable dpi awareness: yes" is not bold, since that's not a default. Something's wrong with your solution config. – rustyx Sep 29 '20 at 12:53
  • @AdrianMole Edward says the additional manifest merges. This is not happening for me. So I think my solution config is broken. – FelixH Sep 29 '20 at 13:23
  • 1
    I found an article about `manifest set`. In the settings of that VC++ project, `Additional Manifest Files` is set to `X-dpi.manifest` and `Enable Dpi manifest` is set to `No`. Hope it can help you. – Barrnet Chou Sep 30 '20 at 05:45
  • The funny thing is: If i right click on the .exe and make the programm dpi aware it works. The manifest and solution settings won't work. This is not really the answer to that... but it works for now. – FelixH Oct 19 '20 at 05:55

1 Answers1

0
  • This appears to be a bug in VS2017. If you can upgrade to VS2019 you should upgrade. This solved the problem for me.

  • If you can't upgrade you can right click on the .exe and enable the
    dpi aware flag in the accessibility settings.

FelixH
  • 135
  • 1
  • 2
  • 14