How can i check if my App is running "As Admin" ?

Posted on 2011-09-23
Medium Priority
Last Modified: 2016-09-29
Is it possible to check if my app is running As Admin ?

for example, you right-click a file and click "Run as administrator", how can i know my app has been clicked "Run as admin" and not just by double clicking it ?
Question by:rotem156
1 Comment

Accepted Solution

Mahdi78 earned 2000 total points
ID: 36590630
You can also try to create Key in Local_Machine root, is your application has admin privilege, the result will be true, look at this example


function IsAdmin : Boolean;
  Reg: TRegistry;
  Reg := TRegistry.Create;
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('SOFTWARE', True) then Result := Reg.CreateKey('')
    else Result := False;

Open in new window


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question