您现在的位置:首页 >> VCL >> VCL >> 内容

Delphi中枚举Web Browser实例窗口,提取HTML文档信息

时间:2011/9/3 16:24:02 点击:

  核心提示:部分代码:procedure TForm1.GetBrowsersButtonClick(Sender: TObject) ;var ShellWindows: TShellWindows; Shel...

部分代码:

procedure TForm1.GetBrowsersButtonClick(Sender: TObject) ;
var
   ShellWindows: TShellWindows;
   ShellWindowDisp: IDispatch;
   WebBrowser: IWebbrowser2;
   Count: integer;
begin
   BrowserList.Clear;
   ShellWindows := TShellWindows.Create(nil) ;
   try
     for Count := 0 to ShellWindows.Count - 1 do
     begin
       ShellWindowDisp := ShellWindows.Item(Count) ;
       if ShellWindowDisp = nil then Continue;
       ShellWindowDisp.QueryInterface(iWebBrowser2, WebBrowser) ;
       if WebBrowser.LocationURL = '' then Continue;
       if Assigned(WebBrowser.Document) then
         BrowserList.Items.Add(WebBrowser.LocationURL) ;
     end;
   finally
     ShellWindows.Free;
   end;
end;

全部代码已经打包下载



迅雷专用高速下载

作者:网络 来源:转载
共有评论 0相关评论
发表我的评论
  • 大名:
  • 内容:
本类推荐
  • 没有
本类固顶
  • 没有
  • 盒子文章(www.2ccc.com) © 2024 版权所有 All Rights Reserved.
  • 沪ICP备05001939号