Hello How can I make a button that requests the admin priviledges from the user? Just like UAC works in Windows, if a program needs admin rights, you get an UAC window. I will mark the correct post as answer of course. thanks
Asked
Active
Viewed 1,310 times
2
-
possible duplicate of [Show UAC prompt when launching an app](http://stackoverflow.com/questions/1215443/show-uac-prompt-when-launching-an-app) – Sedat Kapanoglu Dec 03 '10 at 17:07
-
Possible duplicate of http://stackoverflow.com/questions/573086/how-to-elevate-privileges-only-when-required – Hemant Dec 03 '10 at 17:11
-
You seem to think that the button requests that the app become elevated. It cannot and does not. Instead, the button launches something else, and the something else is elevated (either by code in the button handler or by a manifest on the something else.) The links in the answers are giving you more details, including the "trick" of having "something else" actually be the same app restarting itself. – Kate Gregory Dec 04 '10 at 17:57
2 Answers
1
You cant. You need to specify your whole app is running elevated, OR you can do things a-la-mozilla style, create a helper app that does run as admin, and call it from your UAC button.
Comment if you want clarification.

Machinarius
- 3,637
- 3
- 30
- 53
-1
See this example on CodeProject.
You will have to restart your application to elevate its rights.

shf301
- 31,086
- 2
- 52
- 86
-
Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Daniel A. White May 21 '15 at 10:45