Reputation: 32192
Is it possible from within a c# / .Net program to see the state of the User Account Control Settings
. Specifically I want to know if it is set to one of
Always Notify
Never Notify
I do not want to change the settings but I would like to know what they are.
Upvotes: 2
Views: 523
Reputation: 8117
I am not sure you can do it. What you can do is to create and embed the manifest.
In Windows Vista®, the correct way to mark your applications is to embed an application manifest within your program that tells the operating system what the application needs. In the Windows Vista release, there are provisions to allow non-manifested or unsigned code to run with a full administrative access token.
Please, look at this post.
From my experiences, It correct not only for Vista, but also for Win7, Win2008.
We did try to play with manifest, and it did works.
Also, may be this also help you:
Run command like this to embed manifest to exe:
mt.exe -manifest "C:\path\to\ypur\manifest\my.manifest" -outputresource:"Path\to\your\exefile\My.exe"
Use this command for postbuild events:
mt.exe -manifest "$(ProjectDir)$(TargetName).exe.manifest" -updateresource:"$(TargetDir)$(TargetName).exe;"
Upvotes: 2