且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

启动应用程序时显示 UAC 提示

更新时间:2022-05-26 06:44:16

您需要一个需要提升权限的应用清单.这是回答这个问题的博客引用:

You need an app manifest that demands elevated privileges. Here's a quote from a blog that answers this:

首先,您可以通过添加应用程序清单文件"项目到您的项目(默认名称:app.manifest),然后您可以通过项目属性"中的应用程序"选项卡进行设置.如果您想更改您的 Windows 用户帐户控制级别manifest 文件,你只需要设置 level 属性的值具有以下之一的 requestsExecutionLevel 节点:

First, you can create a manifest file by adding an "Application Manifest File" Item to your project (default name: app.manifest), then you can set it through the Application Tab in the Project Properties. If you want to change the Windows User Account Control level in your manifest file, all you need is to set the value of the level attribute of the requestedExecutionLevel node with one of the following:

  • asInvoker(默认):应用程序将使用当前的 Windows 用户权限运行
  • requireAdministrator:应用程序需要管理员用户
  • highestAvailable:将使用当前用户的最高权限

http://dariosantarelli.wordpress.com/2007/11/21/vs2008-embedding-uac-manifest-options/