Hi all. Can anyone email me direct the code for placing application in startup
menu, NT & Win2000/XP as I understand it is different to earlier versions for
which I have this:

{$IFNDEF NT}
procedure TPRForm.SetStart;
var
  MyObject: IUnknown;
  MySLink: IShellLink;
  MyPFile: IPersistFile;
  FileName: string;
  Directory: string;
  WFileName: WideString;
  MyReg: TRegIniFile;
begin
  MyObject := CreateComObject(CLSID_ShellLink);
  MySLink := MyObject as IShellLink;
  MyPFile := MyObject as IPersistFile;
  FileName := application.Exename;
  with MySLink do begin
    SetArguments('');
    SetPath(PChar(FileName));
    SetWorkingDirectory(PChar(ExtractFilePath(FileName)));
  end;
  MyReg := TRegIniFile.Create(
    'Software\MicroSoft\Windows\CurrentVersion\Explorer');
// Use the next line of code to put the shortcut on your desktop
  Directory := MyReg.ReadString('Shell Folders', 'Startup', '');
  WFileName := Directory + '\ProRem.lnk';
  MyPFile.Save(PWChar(WFileName), False);
  MyReg.Free;
end;
{$ENDIF}

---------------------------------------------------------------------------
    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