在应用程序rc中加入RT_MANIFEST类型资源,ID号为1.内容为
<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"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
当然也可以右键单击应该程序,在弹出的菜单中选“使用管理员身份运行”。