DpiAware in service application

276 views Asked by At

I have a C++ service that execute a Delphi application on NT AUTHORITY\SYSTEM account. The manifest file below was embedded correctly on Delphi application, but application still isn't dpi aware, for example when take a screenshot with 125% DPI the capture not contemplate full desktop. Already executing Delphi application as a normal application, all works fine.

How make Delphi application (that was executed by C++ service) dpiaware?

program Project1;

{$APPTYPE CONSOLE}
{$DYNAMICBASE ON}
{$D+}
{$R *.res}

uses
  System.SysUtils;

begin
  try
    // Screenshot code
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
  Readln;
end.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
    xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity
    type="win32"
    name="MrTheV Dev"
    version="11.0.2804.9245"
    processorArchitecture="*"/>
    <trustInfo
        xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel
          level="requireAdministrator"
          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 Vista -->
            <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
            <!-- Windows 7 -->
            <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
            <!-- Windows 8 -->
            <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        </application>
    </compatibility>
    <asmv3:application>
        <asmv3:windowsSettings
            xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true/PM</dpiAware>
        </asmv3:windowsSettings>
    </asmv3:application>
</assembly>
0

There are 0 answers