delphi7 VISTA UAC的问题
我在XP下使用DELPHI7 因应用程序需要读取注册表,并要能在VISTA下使用,因为UAC的问题,在VISTA下不能读取注册表,以管理员身份运行就可以,我想让应用程序在VISTA下能自动提示用管理员身份运行,在网上看到以下文章,照做之后,还是不行,有那位照以下方法成功的请介绍一下经验,谢谢!
在程序目录下建立如下文件,命名为 程序名.exe.manifest.用Windows记事本保存为UTF8编码格式.
在Delphi2007下编译时,需要购选Project--Options--Application--Enabled Runtime themes.
否则,编译不起作用.D7不需要.修改下面Project1.exe.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="Project1.exe.manifest"
type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
上面的是98,2000风格,下面的是XP,vista风格:
<?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="Project1"
type="win32"
/>
<description>Project1</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</ms_asmv3:requestedExecutionLevel>
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
</assembly>