Question

I have an app which needs administrator privileges to do some things. I'd like to just show the UAC prompt when it starts, and then be elevated. I'm not sure how to do this, but I'm hearing about things like manifests and whatnot but not seeing a plain answer anywhere.

Was it helpful?

Solution

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

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 (default): the application will run using the current Windows user provileges
  • requireAdministrator: the application requires an Administrator user
  • highestAvailable: highest privileges for the current user will be used

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top