title: run program with administrator access to write to registery
body: <p>i tried to use this tutorial to work:
  <a href="https://stackoverflow.com/a/14710803/1149172">https://stackoverflow.com/a/14710803/1149172</a></p>
  
  <p>first create a file with name <code>uac.manifest</code> with provided content
  then create <code>uac.rc</code> width content of <code>1 24 "uac.manifest"</code></p>
  
  <p>then copied the files to program folder (in delphi program sources folder) and changed the project file like this:</p>
  
  <pre><code>program Project4;
  
  {.$R 'uac.res' 'uac.rc'} // UAC only
  
  uses
    Vcl.Forms,
    Unit6 in 'Unit6.pas' {Form6};
  
  {$R *.res}
  
  begin
    Application.Initialize;
    Application.MainFormOnTaskbar := True;
    Application.CreateForm(TForm6, Form6);
    Application.Run;
  end.
  </code></pre>
  
  <p>at last i put my registery code at the form</p>
  
  <pre><code>procedure AddEntryToRegistry;
  var key: string;
       Reg: TRegIniFile;
  begin
    key := 'Software\Microsoft\Windows\CurrentVersion\Run';
    Reg := TRegIniFile.Create;
    try
      Reg.RootKey:=HKEY_LOCAL_MACHINE;
      Reg.CreateKey(Key);
      if Reg.OpenKey(Key,False) then Reg.WriteString(key, 'MyApp', 'c:MyApp.exe');
    finally
      Reg.Free;
    end;
  end;
  </code></pre>
  
  <p>every thing seems ok and i dont got any runtime rror
  but after clicking the button nothing happened (dont shoe any error and dont add the key to registery)!!!
  where is wrong with my works!?</p>
  
  <p>my delphi is xe5 and working on win 8ul</p>