Click here to Skip to main content
15,884,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am converting a VB application to C# .NET 4.5 that configures the desktop wallpaper. The present VB app runs at startup without displaying the UAC dialog. Is there a way for my C# application to run without having to have the UAC dialog pop up? The program queries the register for information on application locations, and will need to be ran at startup for all users. I have tried adding a manifest file, but am fuzzy on how this functions within the OS?
Posted

Please see my comments to Solution 1.

Perhaps, you should start with discussing what are you doing that would require elevated privileges. Is it really needed.

For manifest approach, please see: http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].

I won't eliminate UAC request, it will just avoid some permission exception by enforcing elevated privileges in the very beginning.

If you are irritated by UAC requests, it's possible that you don't quite understand the ideas. Please read this: http://en.wikipedia.org/wiki/User_Account_Control[^].

The idea is not to disable UAC (would be a really bad idea) and not to use it by having the UAC request and responding to it all the time. The real idea is to thoroughly sort the applications and utilities which really need elevation, and those which should better comply with the OS requirements and behave in more legitimate ways, without requesting more privileges. In particular, you should not place your files in wrong places. Instead, you should use "special folders". Failure to comply with the requirements related to the right legitimate directories is one of the most common mistakes leading to permission problems. Please see my past answer: How to find my programs directory[^].

—SA
 
Share this answer
 
Comments
Sascha Lefèvre 22-Apr-15 17:19pm    
+5!

BTW, take a look here:
http://www.codeproject.com/Messages/5046120/Re-Q-A-Solution-Posts-by-Q-A-Inquirers.aspx
:-)
Sergey Alexandrovich Kryukov 22-Apr-15 18:44pm    
Thank you, Sascha.
As to self-answering, hope it will help us. Thank you for raising this issue.
—SA
Check some of the answers here[^]. You cannot remove the popup.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Apr-15 12:57pm    
Not quite: there is "XP" mode and the system option to disable UAC. Both would be really bad ideas though.
The problem could be solved differently: in a startup application, not doing something requiring elevated privileges. :-)
—SA
Abhinav S 22-Apr-15 13:03pm    
Run as administrator. Is that a good idea?
Sergey Alexandrovich Kryukov 22-Apr-15 13:06pm    
Not always. Please see Solution 3.
—SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900