Delphi下如何使程序在Win7/Vista上用管理员权限运行
2009-10-09 13:52
716 查看
操作步骤如下:
1.建立 res 文件
建立一个文本文件,名字可以自己起,我这里叫: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"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
建立文本文件,名为 UAC.rc,内容:
1 24 UAC.manifest
编译成 uac.res 文件,运行:
brcc32 uac.rc -fouac.res
2.在代码中引入
打开项目文件,加入
{$R uac.res}
3.编译程序
这时程序就支持 Win7/VISTA 了,在运行的时候,会弹出 WINDOWS 的提示框,询问用户是否允许以管理员身份运行。
1.建立 res 文件
建立一个文本文件,名字可以自己起,我这里叫: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"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
建立文本文件,名为 UAC.rc,内容:
1 24 UAC.manifest
编译成 uac.res 文件,运行:
brcc32 uac.rc -fouac.res
2.在代码中引入
打开项目文件,加入
{$R uac.res}
3.编译程序
这时程序就支持 Win7/VISTA 了,在运行的时候,会弹出 WINDOWS 的提示框,询问用户是否允许以管理员身份运行。
相关文章推荐
- Delphi下如何使程序在Win7/Vista上用管理员权限运行
- Delphi下如何使程序在Win7/Vista上用管理员权限运行[转]
- Delphi下如何使程序在Win7/Vista上用管理员权限运行
- Delphi下如何使程序在Win7/Vista上用管理员权限运行[转]
- Delphi下如何使程序在Win7/Vista上用管理员权限运行
- Delphi下如何使程序在Win7/Vista上用管理员权限运行(转)
- Delphi下如何使程序在Win7/Vista上用管理员权限运行[转]
- Delphi下如何使程序在Win7/Vista上用管理员权限运行[转]
- Delphi下如何使程序在Vista上用管理员权限运行
- Delphi 如何以管理员权限运行程序
- 如何让Delphi程序启动自动“以管理员身份运行"
- Delphi Xe2 后的版本如何让Delphi程序启动自动“以管理员身份运行"
- 如何让QT程序以管理员权限运行(UAC)
- 如何使DELPHI程序在Win7下自动请求以管理员身份运行
- Vista、Win7上.net程序如何自动使用管理员权限运行
- 如何在程序里模拟在cmd里用管理员权限运行一条指令
- Delphi编译的程序如何获取管理员权限
- 如何设置C#程序在Windows 7 Vista下以管理员权限运行
- 如何让.net程序自动运行在管理员权限下
- 如何在VC中通过添加资源文件,使程序在Vista上用管理员权限运行