Help with Delphi app with vista manifest
- From: "Scott Slater" <scott@xxxxxxxxxx>
- Date: Tue, 20 Mar 2007 19:28:18 -0700
I've got an old D4 app that I've been playing around with under Vista. I've been reading a lot about adding the appropriate embedded manifest information so that Vista will know the execution level my app needs. I think the embedded manifest is working but one part does not seem right. Here is what I have done:
I've created this manifest file called "XPVista.manifest"
<?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="X86"
name="MyApp"
type="win32"/>
<description>My Application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*"/>
</dependentAssembly>
</dependency>
</assembly>
I created this resource file called TEST.RC (contains only 1 line):
1 24 "XPVista.manifest"
I used brcc32 to compile the TEST.RC into TEST.RES
I added {$R TEST.RES} to my project file right below the {$R *.RES} line.
I then compiled my app. When I look at the executable it now correctly shows the shield icon indicating that the application requires elevation. This is due to the "requireAdministrator" option in the manifest. When I dbl-click to run the application I get an error message:
C:\Proj\MyApp\MyApp.exe
The specified path does not exist.
Check the path and try again.
What I expected to get was the nice UAC elevation dialog asking if I wanted to allow the elevation. If I right-click and choose Run as Administrator then the app runs just fine.
Is there a problem with the manifest that I'm using or the way that I have embedded it into the app that is causing the elevation prompt to not work? I've see this "Path does not exist" error before with other apps (like RegEdit.exe for example) where the only way to run them is to choose Run as Administrator on the right-click menu.
Thanks for any advice!
--
Scott Slater
.
- Prev by Date: Re: D2007 vs MS Visual Studio 2005
- Next by Date: Re: D2007 vs MS Visual Studio 2005
- Previous by thread: my very own anonymous QC workaround :)
- Next by thread: John Backus... R.I.P.
- Index(es):
Relevant Pages
|