Click here to Skip to main content
15,892,746 members
Articles / Programming Languages / Visual Basic

A Quick-Start Guide of Process Mandatory Level Checking and Self-elevation under UAC

Rate me:
Please Sign up or sign in to vote.
4.84/5 (63 votes)
23 Mar 2010Ms-PL5 min read 130.8K   5K   155  
This example demonstrates how to check the privilege level of the current process, and how to self-elevate the process by giving explicit consent with the Consent UI.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by CppUACSelfElevation.rc
//
#define IDD_MAINDIALOG                  103
#define IDC_ELEVATE_BN                  1000
#define IDC_INADMINGROUP_STATIC         1001
#define IDC_ISRUNASADMIN_STATIC         1002
#define IDC_ISELEVATED_STATIC           1003
#define IDC_IL_STATIC                   1004
#define IDC_STATIC                      -1

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC                     1
#define _APS_NEXT_RESOURCE_VALUE        129
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1005
#define _APS_NEXT_SYMED_VALUE           110
#endif
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
China China
Microsoft All-In-One Code Framework delineates the framework and skeleton of Microsoft development techniques through typical sample codes in three popular programming languages (Visual C#, VB.NET, Visual C++). Each sample is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used coding scenario based on our support experience in MSDN newsgroups and forums. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer's question coincides with what we collected.
http://cfx.codeplex.com/

Comments and Discussions