<? 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 =anifest"
type ="win32"
/>
< trustInfo xmlns ="urn:schemas-microsoft-com:asm.v3" >
< security >
< requestedPrivileges >
< requestedExecutionLevel level ="requireAdministrator" uiAccess ="false" />
</ requestedPrivileges >
</ security >
</ trustInfo >
</ assembly >
注:此文件只要扩展名是.manifest文件名可以任意。文件内容的name属性值也可以为任意。(VC6.0下经过测试)
注:经测试资源类型必须为24,资源ID也必须为1,
如果是VC 2005或者2008 就更简单了,直接项目右键—属性—连接器—清单文件—uac执行级别 选择requireAdministrator 重新编译 这样你的程序直接运行就拥有管理员权限了。
如果是C#.NET 2005或2008,则直接在项目中添加一个manifest文件,如app.manifest,创建后,把中的asInvoker替换成requireAdministrator即可,如:
<? xml version="1.0" encoding="utf-8" ?>
< asmv1:assembly manifestVersion ="1.0" xmlns ="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1 ="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2 ="urn:schemas-microsoft-com:asm.v2" xmlns:xsi ="" >
< assemblyIdentity version ="1.0.0.0" name ="MyApplication.app" />
< trustInfo xmlns ="urn:schemas-microsoft-com:asm.v2" >
< security >
< requestedPrivileges xmlns ="urn:schemas-microsoft-com:asm.v3" >
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
< requestedExecutionLevel level ="requireAdministrator" uiAccess ="false" />
</ requestedPrivileges >
</ security >
</ trustInfo >
</ asmv1:assembly >
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrentVersionAppCompatFlagsLayers]
“C:Program ”=“RUNASADMIN”
将上面的内容保存为.reg文件,基中把C:Program 改为真实环境的应用程序地址,双击运行即可。
这种方法后应用程序图标不会有盾状图标,但双击运行仍然会弹出对话框要求提升权限。
附:XP风格的manifest
<? xml version="1.0" encoding="UTF-8" standalone="yes" ?>
< assembly xmlns ="urn:schemas-microsoft-com:asm.v1" manifestVersion ="1.0" >
< dependency >
< dependentAssembly >
< assemblyIdentity
type ="win32"
name ="Microsoft.Windows.Common-Controls"
version ="6.0.0.0"
processorArchitecture ="X86"
publicKeyToken ="6595b64144ccf1df"
language ="*"
/>
</ dependentAssembly >
</ dependency >
</ assembly >
本文发布于:2024-02-04 06:51:22,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170701482953341.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |