Click here to Skip to main content
11,503,839 members (77,612 online)
Click here to Skip to main content

Tagged as

Is Your App Running As Administrator?

, 19 Jan 2011 CPOL 10.6K 18
Rate this:
Please Sign up or sign in to vote.
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Samuel Cragg

United Kingdom United Kingdom
No Biography provided

Comments and Discussions

 
GeneralMy vote of 1 Pin
vijayksingh19-Feb-13 17:58
membervijayksingh19-Feb-13 17:58 
GeneralReason for my vote of 5 good to know Pin
johannesnestler2-Mar-12 1:36
memberjohannesnestler2-Mar-12 1:36 
GeneralReason for my vote of 5 Good alternative... Pin
Pravin Patil, Mumbai1-Nov-11 18:52
memberPravin Patil, Mumbai1-Nov-11 18:52 
GeneralMaybe both approaches are valid. If the windows can't unders... Pin
danlobo18-Oct-11 2:42
memberdanlobo18-Oct-11 2:42 
GeneralYeah, I knew about this, but I don't want the UAC to pop up.... Pin
John Simmons / outlaw programmer24-Jan-11 23:46
mvpJohn Simmons / outlaw programmer24-Jan-11 23:46 
GeneralRe: Fair point, both methods ultimately lead to the same result ... Pin
Sam Cragg25-Jan-11 2:30
memberSam Cragg25-Jan-11 2:30 
Fair point, both methods ultimately lead to the same result so can't say anything wrong about your method.

I would like to point out that with this method the UAC will pop-up only once at the start of the app and you can have as many forms as you like without further interference. It also has the added benefit that the app icon will have a shield over it (not sure about Vista though) so the user gets a visual clue before running the app that it will need to be run with administrator privileges.
GeneralReason for my vote of 5 because I learned new way about chec... Pin
RaviRanjankr22-Jan-11 6:42
mvpRaviRanjankr22-Jan-11 6:42 
GeneralReason for my vote of 5 Very much needed thing... Pin
Pravin Patil, Mumbai20-Jan-11 21:52
memberPravin Patil, Mumbai20-Jan-11 21:52 
GeneralReason for my vote of 5 Good to learn about something I can ... Pin
Chris Trelawny-Ross20-Jan-11 7:05
memberChris Trelawny-Ross20-Jan-11 7:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 19 Jan 2011
Article Copyright 2011 by Samuel Cragg
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid