This works well in NT/XP:
procedure TMainForm.RunOnStartup(sProgTitle, sCmdLine: string; bAdd: boolean);
var
  reg: TRegIniFile;
  tstring: string;
begin
  reg := TRegIniFile.Create('');
  reg.RootKey := HKEY_CURRENT_USER;
  tstring := 'Software\Microsoft\Windows\CurrentVersion\Run\' + #0;
  if (bAdd) then reg.WriteString(tstring, sProgTitle, sCmdLine)
  else
    reg.DeleteKey(tstring, sprogtitle);
  reg.Free;
end;

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to