快捷方式的函数

发表于:2007-07-01来源:作者:点击数: 标签:

                                      快捷方式的函数

                                               

use  shlobj,comobj,activex;//查DEL6VCL.HLP可以查到olecheck属于comobj
procedure   link(const appname,savepath:string);
var
sl:IShellLink;
pf:IPersistFile;
lnkname:widestring;
begin
olecheck(cocreateinstance(CLSID_ShellLink,nil,CLSCTX_INPROC_SERVER,IShellLink,sl));
pf:=sl as IPersistFile;
olecheck(sl.setpath(pchar(appname)));
lnkname:=savepath+´´+changefileext(extractfilename(appname),´.lnk´);
pf.save(pwidechar(lnkname),true);
end;


原文转自:http://www.ltesting.net