如何在每次启动应用程序时摆脱 UAC

How do I get rid of the UAC everytime I start my application

本文关键字:UAC 应用程序 启动      更新时间:2023-10-16

我已经使用威瑞信签署了我的应用程序,将所有注册表变量存储在 HKCU 中,以便不请求管理员权限,但 UAC 命令仍然提示用户他/她是否希望以下内容对他/她的计算机进行更改。我如何防止这种情况发生。

下面显示了 VS 生成的清单文件

   <?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level='asInvoker' uiAccess='false' />
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32'              name='Microsoft.Windows.Common-Controls'        version='6.0.0.0'                               processorArchitecture='x86'                   publicKeyToken='6595b64144ccf1df'               language='*' />
    </dependentAssembly>
  </dependency>
</assembly>

正如我所怀疑的那样,这种行为的解释可以在应用程序清单中找到。您已指定请求的执行级别 requireAdministrator 。正是该设置导致显示 UAC 对话框。将其更改为asInvoker以避免请求提升。

....
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
....

Visual Studio IDE中可能有一个设置来控制这一点。我不熟悉这一点,但我希望这就是实现这种变化所需的方式。好的,我查了一下。IDE 设置位于配置页的"链接器"节点的"清单文件"部分下。可以在此处找到相关文档:http://msdn.microsoft.com/en-us/library/bb384691.aspx

在 MSDN 上阅读有关应用程序清单的信息。