Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 41555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:11:57+00:00 2026-05-10T15:11:57+00:00

My Vista application needs to know whether the user has launched it as administrator

  • 0

My Vista application needs to know whether the user has launched it ‘as administrator’ (elevated) or as a standard user (non-elevated). How can I detect that at run time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:11:58+00:00Added an answer on May 10, 2026 at 3:11 pm

    The following C++ function can do that:

    HRESULT GetElevationType( __out TOKEN_ELEVATION_TYPE * ptet );  /* Parameters:  ptet     [out] Pointer to a variable that receives the elevation type of the current process.      The possible values are:      TokenElevationTypeDefault - This value indicates that either UAC is disabled,          or the process is started by a standard user (not a member of the Administrators group).      The following two values can be returned only if both the UAC is enabled     and the user is a member of the Administrator's group:      TokenElevationTypeFull - the process is running elevated.       TokenElevationTypeLimited - the process is not running elevated.  Return Values:      If the function succeeds, the return value is S_OK.      If the function fails, the return value is E_FAIL. To get extended error information, call GetLastError().  Implementation: */  HRESULT GetElevationType( __out TOKEN_ELEVATION_TYPE * ptet ) {     if ( !IsVista() )         return E_FAIL;      HRESULT hResult = E_FAIL; // assume an error occurred     HANDLE hToken   = NULL;      if ( !::OpenProcessToken(                  ::GetCurrentProcess(),                  TOKEN_QUERY,                  &hToken ) )     {         return hResult;     }      DWORD dwReturnLength = 0;      if ( ::GetTokenInformation(                 hToken,                 TokenElevationType,                 ptet,                 sizeof( *ptet ),                 &dwReturnLength ) )     {             ASSERT( dwReturnLength == sizeof( *ptet ) );             hResult = S_OK;     }      ::CloseHandle( hToken );      return hResult; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need my application to behave differently depending on whether Vista UAC is enabled
If I develop a .Net application that's going to run on WinXP and Vista,
I have some services that an application needs running in order for some of
I'm working with a Win32 application that needs to create a variety of custom
For part of a web application the user needs to import some data from
We need to programatically burn files to CD in a C\C++ Windows XP/Vista application
I am developing an application from windows vista machine. The web application is hosted
On Vista, I got a problem with the application crash handler. Basically, if something
I have an ASP.NET application developed on my Vista box (IIS7). It works fine
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.