Solved

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

Posted on 2011-09-23
1
675 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

809 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