65.9K
CodeProject is changing. Read more.
Home

Is Your App Running As Administrator?

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.97/5 (24 votes)

Jan 19, 2011

CPOL
viewsIcon

28401

You can also add an application manifest file. If you're using VS 2010, there's an option for one in the "Add New Item" dialog (right click on the project, click "Add" then click "New Item") and edit the generated file to uncomment the line that says:<requestedExecutionLevel ...

You can also add an application manifest file. If you're using VS 2010, there's an option for one in the "Add New Item" dialog (right click on the project, click "Add" then click "New Item") and edit the generated file to uncomment the line that says:
<requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
This not only forces the UAC dialog to open when you run the application, it also puts a little shield over your icon (well, in Windows 7 anyway). There's a little more information on MSDN here.