有一种朋友不在生活里,却在生命力;有一种陪伴不在身边,却在心间。图老师即在大家的生活中又在身边。这么贴心的服务你感受到了吗?话不多说下面就和大家分享在Vista操作系统中通过manifest文件使VC应用程序获得管理员权限吧。
【 tulaoshi.com - 编程语言 】
VC编译出来的应用程序在vista下运行,有可能因为权限问题,不能成功运行。
用以下办法,给应用程序添加一个manifest文件,程序运行时系统就会跳出UAC对话框,获得管理权限。
1.打开应用程序的源代码工程
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)2.添加一个“custom”资源,"resource type"填24,把资源ID改为1,然后把以下内容复制到资源内容中保存
?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="mulitray.exe.manifest"
type="win32"
/
trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"
security
requestedPrivileges
requestedExecutionLevel level="requireAdministrator" uiAccess="false"/
/requestedPrivileges
/security
/trustInfo
/assembly
3.重新编译应用程序,此时会发现,广用程序的图标在vista下会多出一个小盾标志。
来源:http://www.tulaoshi.com/n/20160219/1625263.html
看过《在Vista操作系统中通过manifest文件使VC应用程序获得管理员权限》的人还看了以下文章 更多>>