My program should run as administrator. Two years ago, I create a manifest file and it works fine. But now, I transfer from Delphi 2010 to Delphi XE3 and it doesn’t work – program start as usual (not as administrator). Further I will call my program as "MyApp".
In source, I declare two res-files:
{$R MyApp.res}
{$R Manifest.res}
Manifest was create by this code:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="MyApp"
version="1.1.0.0"
processorArchitecture="x86"/>
<description>
MyApp
</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="*deleted*"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
When I delete {$R MyApp.res} from source manifest work. So I understand that MyApp.res (automatically generated by Delphi) beat Manifest.res. But in Delphi 2010 this configuration works perfect but doesn't work in XE3. Why? How I can fix it?
If you want to use a custom .res file for your manifest, you need to disable Delphi's default manifest, as a process can only have 1 manifest. Go into the Project Options, in the "Application" section, and set the "Runtime Themes" option to "none".
Alternatively, move your manifest into a .manifest file, then set the "Runtime Themes" option to "use a custom manifest". Then remove your custom .res file from your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With