procedure createico(s:string;s1:string);//s:程序名称 s1:快捷方式名称
var
tmo:iunknown;
tms:ishelllink;
tmpf:ipersistfile;
pidl:pitemidlist;
sd:array[0..max_path] of char;
sf,ss:string;
linkf:widestring;//要引用shlobj,comobj,activex 在 uses
begin
sf:=s;
tmo:=createcomobject(clsid_shelllink);
tms:=tmo as ishelllink;
tmpf:=tmo as ipersistfile;
s:=extractfilepath(s);
tms.SetPath(pchar(sf));
tms.setworkingdirectory(pchar(s));
shgetspecialfolderlocation(0,csidl_desktopdirectory,pidl);
shgetpathfromidlist(pidl,sd);
ss:=sd;
ss:=ss+'\'+(s1)+'.lnk';
linkf:=ss;
tmpf.save(pwchar(linkf),false);
end;
在桌面上创建.lnk的方法
最新推荐文章于 2024-04-03 15:58:20 发布