Widnows7下让应用程序自动请求管理员权限

添加一个Application Manifest文件,设置trustInfo节如下:

<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" />

          Specifying requestedExecutionLevel node will disable file and registry virtualization.
          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>
posted @ 2010-09-20 15:42  风中的云  阅读(654)  评论(0编辑  收藏  举报