本文整理自网络,侵删。
uses ActiveX,ComObj;
const CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
procedure AddFavorite(Webbrowser:TWebBrowser);varShellUIHelper: ISHellUIHelper;url, title: Olevariant;begin Title := Webbrowser.LocationName; Url := Webbrowser.LocationUrl; if Url <>'' then begin ShellUIHelper := CreateComObject(CLSID_SHELLUIHELPER) as IShellUIHelper; ShellUIHelper.AddFavorite(url, title); end;end;
procedure TForm1.Button1Click(Sender: TObject);
beginAddFavorite(WebBrowser1);end;
procedure TForm1.FormCreate(Sender: TObject);beginWebBrowser1.Navigate('http://www.delphitop.com');end;
相关阅读 >>
Delphi firedac tfdconnection连接mysql数据库
Delphi 使用onvalidate事件或onvalidating事件验证在输入字段(tedit)中输入的值
Delphi win7,win2008,win2003,winxp 屏蔽ctrl+alt+del
Delphi中使用xmlhttp / xmlhttprequest 避免缓存
更多相关阅读请进入《Delphi》频道 >>