Solved

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

Posted on 2011-09-23
1
663 Views
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 ?
0
Comment
Question by:rotem156
1 Comment
 
LVL 9

Accepted Solution

by:
Mahdi78 earned 500 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


uses
 Registry;

function IsAdmin : Boolean;
var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
    try
    Reg.RootKey := HKEY_LOCAL_MACHINE;
    if Reg.OpenKey('SOFTWARE', True) then Result := Reg.CreateKey('')
    else Result := False;
    finally
    Reg.CloseKey;
    Reg.Free;
    end;
end;

Open in new window

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now