Title: How to set an application into windows autorun
Question: Edit the registry to add a program into windows autorun.
Answer:
procedure SetAutorun(aProgTitle,aCmdLine: string;
aRunOnce: boolean );
var
hKey: string;
hReg: TRegIniFile;
begin
if aRunOnce then hKey := 'Once'
else
hKey := '';
hReg := TRegIniFile.Create( '' );
hReg.RootKey := HKEY_LOCAL_MACHINE;
hReg.WriteString('Software\Microsoft\Windows\CurrentVersion\Run'
+ hKey + #0,
aProgTitle,
aCmdLine );
hReg.destroy;
end;