在工作过程中,我可能可能遇到要求编译好的程序默认以管理员权限运行,我们可以这样操作
一、新建一个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="nim_demo.exe.manifest" type="win32" /> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> <!--<requestedExecutionLevel level="asInvoke" uiAccess="false"/>--> </requestedPrivileges> </security> </trustInfo> </assembly>
命名为:appXXX.exe.manifest(appXXX为你的程序)
并将它放到你的bin文佳目录下
二、依次为:
$(IntDir)$(TargetName)$(TargetExt).intermediate.manifest
是
ResuestAdmin....
三、将第一步的文件以资源方式引入程序