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

My WinForms application has the standard Aero glass appearance on Vista/Windows 7. I want
I'm writing a service application that needs to enumerate all current user sessions, and
I'm currently trying to write a Windows Media Center Application (Vista) that can restart
I have a VB6 application that needs to be installed on Windows Vista as
We are working on a Vista/Windows 7 application that will be running in 64
I'm writing an application that interacts with other processes on a x64 Vista machine.
How can I have my application minimize itself to the system tray in WindowsXP/Vista?
I have an application that write data in the programdata folder in vista. The
We have a C# application that works fine on windows XP and windows vista
I'm working with a Win32 application that needs to create a variety of custom

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.