uses Registry; ... procedure AutoInicio; 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, 'Nombre Aplicación', 'c:\aplicacion.exe'); finally Reg.Free; end; end;
Y para removerlo:
uses Registry; ... procedure RemoverAutoInicio; var key: string; Reg: TRegIniFile; begin key := '\Software\Microsoft\Windows\CurrentVersion\Run'; Reg:=TRegIniFile.Create; try Reg.RootKey:=HKey_Local_Machine; if Reg.OpenKey(Key,False) then Reg.DeleteValue('Nombre de la Aplicación'); finally Reg.Free; end; end;
Qué lo disfruten .
Saludos.