Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

792 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