uses ...,registry,comobj,shlobj,activex;
procedure AddDesktopLink(linkfile, programfile: string);
var
Reg: TRegIniFile;
WFileName: WideString;
AnObj: IUnKnown;
Shlink: IShellLink;
PFile: IPersistFile;
begin
try
coinitialize(nil);
AnObj := CreateComObject(CLSID_ShellLink);
shLink := AnObj as IShellLink;
PFile := AnObj as IPersistFile;
shLink.SetPath(PChar(programfile));
shLink.SetWorkingDirectory(PChar(ExtractFilePath(ProgramFile)));
Reg := TRegIniFile.Create('Software/MicroSoft/Windows/CurrentVersion/Explorer');
WFileName := Reg.ReadString('Shell Folders', 'Desktop', '') +
'/' + linkfile + '.lnk';
PFile.Save(PWChar(WFileName), True);
Reg.Free;
except
end;
end;