How to detect whether Vista UAC is enabled?

后端 未结 8 1297
渐次进展
渐次进展 2021-01-31 04:48

I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user\'s computer?

8条回答
  •  温柔的废话
    2021-01-31 05:26

    This post has sample code in C# to test if UAC is on and if the current app has been given elevated rights. You can download the code and interpret as needed. Also linked there is a sample that shows the same in C++

    http://www.itwriting.com/blog/198-c-code-to-detect-uac-elevation-on-vista.html

    The code in that post does not just read from the registry. If UAC is enabled, chances are you may not have rights to read that from the registry.

提交回复
热议问题