How To Run Delphi Program As Administrator

If you want to run the program as administrator , you need to provide UAC (User Account Control) manifest to your provide.

Running Delphi Program As Administrator

  • Open Your Project Folder Of Delphi.
  • Create A New File With name adminfile.manifest  [ You can choose any desired name instead of adminfile , in this case my file name is adminfile ]
  • Now Paste The Following Code In adminfile.manifest And Save The File.

  • Now Create A New File In The Same Folder . Name It As adminfile.RC
  • Paste The Following Code In adminfile.RC And Save The File.

  • Now Open Command Prompt (CMD) And Execute The Following Command :

  • After The Execution Of This Command , A New File Will Be Generated With Name adminfile.res .
Don't Want To Perform Above Steps Manually ? Check My Tool Which Will Automate These Steps In One Click . Click Here
  • Now Open Your Main Unit Of Delphi Project And Paste Following Code After 'uses' :

  • Now Save And Compile The Project.

  • Our Program Successfully Got Admin Privilege :)

Tool To Generate Those Files And Execute Command

I made a tool which will generate all those files which are listed above and will automatically execute command prompt's command.

How To Use This Tool ?

  • Put This Program In Your Delphi's Project Folder.
  • Click On Build Button.
  • A New Dialog Will Open With Info That File Generated Successfully. Copy The Code Present In That Dialog And Paste It In Your Delphi's Main Unit Under 'uses' As We Have Done Before.

  • Done. Your Program Will Get Admin Privilege.