Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: How to set DPI awareness using XE7



Permlink Replies: 8 - Last Post: Aug 24, 2017 6:04 AM Last Post By: Harry Bego Threads: [ Previous | Next ]
Harry Bego

Posts: 22
Registered: 1/27/09
How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2017 3:20 AM
I'm trying to set a project DPI aware, using XE7. I have added the usual manifest file, containing <dpiAware>True</dpiAware> etc., and added a resource file to the project, linking it.

Still, if I run the program in Windows 7 at 125% text size with "use Windows XP style DPI scaling" switched off, I get the DPI virtualization, with fuzzy rendering.

So it looks like the DPI-aware setting doesn't work.

Am I missing something? Thanks for any clues!

Harry
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2017 10:10 AM   in response to: Harry Bego in response to: Harry Bego
Harry Bego wrote:

So it looks like the DPI-aware setting doesn't work.

Then you did not apply the manifest correctly. For starters, have you
tried using the IDE's "use custom manifest" option, instead of using a
resource file? Maybe you used the wrong resource ID, so the OS can't
find your manifest. Who knows. You did not provide any details about
how you setup your manifest.

--
Remy Lebeau (TeamB)
Harry Bego

Posts: 22
Registered: 1/27/09
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2017 12:59 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thanks much for your reply Remy. I did not use the custom manifest setting in the Project options. A point is that I'm using VCL styles and need the runtime themes enabled.

I added a .rc file to the project with content like this:

1 24 "MyApp.manifest"

and the manifest itself is this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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/2005/WindowsSettings">
      <dpiAware>True</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2017 3:16 PM   in response to: Harry Bego in response to: Harry Bego
Harry Bego wrote:

I did not use the custom manifest setting in the Project options.

Why not? It is easier then setting up an .rc file.

A point is that I'm using VCL styles and need the runtime themes
enabled.

So? Simply create a custom manifest that enables both Runtime Themes
and DPI awareness (and configures UAC and OS requirements as needed).

and the manifest itself is this:

Your manifest should look more like this instead:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
  <assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="CompanyName.ProductName.YourApplication"
    type="win32" />
  <description>Your application description here.</description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />	
      </requestedPrivileges>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    <application> 
      <!-- Windows 10 --> 
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
      <!-- Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
      <!-- Windows 8 -->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
      <!-- Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
      <!-- Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> 
    </application> 
  </compatibility>
  <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>True</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>


--
Remy Lebeau (TeamB)
Harry Bego

Posts: 22
Registered: 1/27/09
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2017 4:48 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you so much Remy, that worked. Of course it did. You're a star. Where would we be without you!

The MS VS documentation about manifests says that a "publicKeyToken" attribute is required for the <assemblyIdentity> element. But it appears to work without it. (https://msdn.microsoft.com/en-us/library/et7946ex.aspx)

Harry
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2017 1:34 PM   in response to: Harry Bego in response to: Harry Bego
Harry Bego wrote:

The MS VS documentation about manifests says that a "publicKeyToken"
attribute is required for the <assemblyIdentity> element. But it
appears to work without it.

A publicKeyToken only applies to signed executables. You don't need to
specify your own publicKeyToken unless you sign your own executable.

But in any case, you are referring to the documentation for a
"ClickOnce deployment manifest", not an "Application manifest". Two
different things. Read the following MSDN documentation instead:

Application Manifests
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374191.aspx

It says that the publicKeyToken is optional in an <assemblyIdentity>
element that is a child of the top-level <assembly> element (ie, the
assembly of the application itself). The publicKeyToken is only
required for side-by-side <assemblyIdentity> elements that are children
of a <dependentAssembly> element (like when enabling ComCtrl32 v6).

--
Remy Lebeau (TeamB)
Harry Bego

Posts: 22
Registered: 1/27/09
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 24, 2017 6:03 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Okay I see. Thank you for clarifying!
Mike Versteeg

Posts: 118
Registered: 9/16/07
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2017 3:10 AM   in response to: Harry Bego in response to: Harry Bego
Harry Bego wrote:
I'm trying to set a project DPI aware, using XE7.

If you are looking into more than just making it DPI aware, consider upgrading to 10.2.1 as it has upgraded support for DPI awareness. There is also more coming in the next release, specifically related to per-monitor DPI awareness. I've started a thread about this topic a few weeks ago on G+.
Harry Bego

Posts: 22
Registered: 1/27/09
Re: How to set DPI awareness using XE7
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2017 5:07 AM   in response to: Mike Versteeg in response to: Mike Versteeg
Thanks Mike. I read your posts. For now I have excluded styling for menus, radio buttons and checkboxes. I'll certainly upgrade at some point, but there seems to be new confusion regarding scaling, and the default PixelsPerInch value seems to be wrong-footing some folks.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02