Prevent UAC Dialog
We linked our application with a manifest with requireAdministrator option in c++. This is because the ap开发者_StackOverflowplication modifies HKLM registry entries. When we execute the application, Windows displays the following message. Is it possible to make this window do not appear for our application without changing the UAC setting of Windows?
The basic answer is no. UAC is designed to prompt you for just this purpose. If you could bypass the UAC for your good application, the same could be true for the bad applications that are out there. Because you are writing to the registry at HKLM, you have to elevate your access.
You could move the dialog around a bit if you want. For example, you could create an application icon that would immediately prompt the user with the UAC when they started the application but that isn't a great idea since the point of UAC is to run without permissions until they are needed.
Here is a link to more information about the UAC and how to work with it:
http://msdn.microsoft.com/en-us/magazine/cc163486.aspx
精彩评论