А можно и без функций. Вот:
Код:
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
reg:TRegistry;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
if reg.KeyExists('Software\Microsoft\Windows\CurrentVersion\Run') then
reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',false);
reg.WriteString('Your Program','"'+Application.ExeName+'"');
reg.CloseKey;
reg.CloseKey;
reg.Free;
if not reg.KeyExists('Software\Microsoft\Windows\CurrentVersion\Run') then
reg.Free;
end;
end.