Author Topic: Make program dpi-aware  (Read 3065 times)

Offline c-coder

  • Single posting newcomer
  • *
  • Posts: 2
Make program dpi-aware
« on: August 25, 2015, 03:02:40 pm »
I need to make my program dpi-aware.

I created a file "dpiaware.manifest":
Code: [Select]
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2001/WindowsSettings">
      <dpiAware>true</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

and saved the file in my main project folder.

There I also created a file "resources.rc":
Code: [Select]
1 24 "dpiaware.manifest"
And then I compiled.
But the compiled *.exe is not dpi aware.

It is dpi aware if I rename the manifest file to *.exe.manifest and ship it with my program.
But I want to integrate the manifest file into my program exe file.
I do not want to use Visual Basic or any Microsoft tools like "mt.exe".
I want to do everything with Code::Blocks.

Please help me to find the right steps.

Offline c-coder

  • Single posting newcomer
  • *
  • Posts: 2
Re: Make program dpi-aware
« Reply #1 on: August 25, 2015, 03:36:29 pm »
Please forgive me. I found out that I need to "Rebuild" the project, not only "Build an run" for the changes to take effect.
It works, and you don't even need quotes:
Code: [Select]
1 24 dpiaware.manifestAnd you don't need to include the manifest file in your project.
You only need resources.rc.

Offline Ryval

  • Single posting newcomer
  • *
  • Posts: 2
Re: Make program dpi-aware
« Reply #2 on: May 31, 2016, 08:11:24 pm »
It's stuff like this that is extremely aggravating.

I am doing exactly what you're doing. Yet it just magically works for you, but gives me errors left and right.

I too need to declare my program as DPI aware, otherwise my program thinks it's okay to look all wonky and ass backwards whenever the user has the font scaling higher than normal.

I created the file DeclareDPIAware.manifest, put it in my project folder, and put this line in my resource file.

http://i.imgur.com/bqgSKmA.png

Yet I just get "Syntax Error"

http://i.imgur.com/ACoMdC5.png

Thanks codeblocks, very descriptive.

My manifest file:

http://i.imgur.com/E1BDouV.png


Why is it peaches and cream for you but poop and mud for me with the same method? This makes zero sense.

Even adding a 24 before it does not work.


EDIT:

Okay so going into wx.rc I saw manifest files were added differently because this is a wxWidgets program.

http://i.imgur.com/pmPDzN3.png

Applying that same logic, I got it to work.

http://i.imgur.com/7DPoCN0.png

Sorry for the necro, but maybe in the future another soul like me will come across this thread stuck as I was and see the solution.


« Last Edit: May 31, 2016, 08:29:48 pm by Ryval »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9597
Re: Make program dpi-aware
« Reply #3 on: June 10, 2016, 11:21:17 am »
It's stuff like this that is extremely aggravating.
Sorry, but you should have simply read more carefully. Integrating manifest files into RC file must be done exactly like mentioned:
Code: [Select]
1 24 dpiaware.manifest
Note the 1 24 in front. You also have to understand that this is Microsoft policy, not C::B's. Please RTFM if you are using MS technology.

Its unfair to blame us for you not being able to read more carefully. Also, the error message you refer to does not come from Code::Blocks but the compiler. So again: Don't blame the wrong person. And if you want to see the full error you should look into the build log, not the condensed build messages.

Thank you.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ