抄了一段,稍微有点改动
——
uses
...,ActiveX, ComObj, ShlObj;
procedure TForm1.FormCreate(Sender: TObject);
var
ShLink: IShellLink;
PFile: IPersistFile;
FileName: WideString;
begin
FileName := ExtractFilePath(Application.ExeName) + '快捷方式 '
+ ExtractFileName(Application.ExeName) + '.lnk';
if FileExists(FileName) then Exit;
ShLink := CreateComObject (CLSID_ShellLink) as IShellLink;
PFile := ShLink as IPersistFile;
ShLink.SetPath(PChar(Application.ExeName));
ShLink.SetWorkingDirectory(PChar(ExtractFilePath(Application.ExeName)));
PFile.Save(PWChar(FileName), False);
end;