首页 > Windows开发 > 详细

Delphi生成EXE自动以管理员身份运行

时间:2016-05-31 13:44:42      阅读:584      评论:0      收藏:0      [点我收藏+]

【测试环境】Windows 7 旗舰版 With Sp1,RAD 10 Seattle

 

1、文本文件:UAC.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"
language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>

 

2、文本文件:UAC.rc

1 24 UAC.manifest

 

3、拷贝上述两个文件到RAD10目录下/bin(如Embarcadero\Studio\17.0\bin)

 

4、用brcc32编译这个.rc文件为.res文件

brcc32 uac.rc -fouac.res

 

5、在工程文件.dpr中{$R *.res}后面加入{$R uac.res}

 

6、打开工程属性,Application->Manifest File,改成Custom,在下方选择UAC.manifest文件,重新编译工程。

 

Delphi生成EXE自动以管理员身份运行

原文:http://www.cnblogs.com/cookiedragon/p/5545488.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!