| 。
--------------------------------------------------------------------------------------------------------
14、通过IUniformResourceLocator接口建立Internet快捷方式
前面说到的显示“添加到收藏夹”模式对话框的方法中举了一个建立Internet快捷方式的例子,就其本身来说不太规范,属于取巧一类的方法。下面介绍的方法是通过接口来实现的。
procedure CreateIntShotCut(aFileName, aURL: PChar); var IURL: IUniformResourceLocator; PersistFile: IPersistfile; begin if Succeeded(CoCreateInstance(CLSID_InternetShortcut, nil, CLSCTX_INPROC_SERVER, IID_IUniformResourceLocator, IURL)) then begin IUrl.SetURL(aURL, 0); Persistfile := IUrl as IPersistFile; PersistFile.Save(StringToOleStr(aFileName), False); end; end;
其中IUniformResourceLocator接口的声明在IeConst.pas中,IeConst.pas可以在网站IE & Delphi找到; IPersistfile接口的声明在ActiveX.pas中。
注:这个函数的AURL参数必须包含协议前缀,如“Http://eagleboost.myrice.com”。
最先发表日期:2000年07月25日
最后修改日期:2001年02月07日
上一页 [1] [2] [3] |