function RunAsAdmin (hwnd:hwnd; filename:string; parameters:string): Boolean; {See Step 3:redesign for UAC compatibility (UAC) Http://msdn.microsoft.com/en-us/library/bb756922.aspx}var Sei:tshellexecuteinfo;begin ZeroMemory (@sei, SizeOf (SEI)); Sei.cbsize: = SizeOf (tshellexecuteinfo); Sei. WND: = hwnd; Sei.fmask: = See_mask_flag_ddewait or see_mask_flag_no_ui; Sei.lpverb: = PChar (' runas '); Sei.lpfile: = PChar (Filename); Pansichar; If parameters <> ' then sei.lpparameters: = PChar (parameters);//Pansichar; Sei.nshow: = Sw_shownormal; Integer; Result: = ShellExecuteEx (@sei); end;
See Mask values here:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784 (v=vs.85). aspx
This article would show you what to create a Delphi application with a manifest to request elevation (run as Admin). Read the article, it has a link to Delphi Manifest creator for doing this-very Nice! It'll save you a lot of work. So if the program, you need to run are written in Delphi and you had the source code then use this method.
Http://delphi.about.com/od/delphitips2009/qt/delphi-vista-registry-run-on-startup.htm
Https://stackoverflow.com/questions/15319158/use-shell-execute-to-run-cmd-as-admin
RunAsAdmin in Windows 8