加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Delphi获取所有打开的IE窗口的网页源码

发布时间:2020-12-15 10:02:16 所属栏目:大数据 来源:网络整理
导读:procedure ?TForm1.Button1Click(Sender: TObject); var ? ShellWindow: IShellWindows; ? i: Integer; ? spDisp: IDispatch; ? IE1: IWebBrowser2; begin ? ShellWindow := CoShellWindows.Create; ? for i:=0 to ShellWindow.Count - 1 do ? begin ??? spD
procedure ?TForm1.Button1Click(Sender: TObject);
var
? ShellWindow: IShellWindows;
? i: Integer;
? spDisp: IDispatch;
? IE1: IWebBrowser2;
begin
? ShellWindow := CoShellWindows.Create;
? for i:=0 to ShellWindow.Count - 1 do
? begin
??? spDisp := ShellWindow.Item(i);
??? if spDisp <> nil then
??? begin
????? spDisp.QueryInterface(iWebBrowser2,IE1);
????? if IE1 <> nil then
????? begin
??????? if Pos('http://',LowerCase(IE1.LocationURL)) = 1 then
??????? begin
????????? Memo1.Lines.Add(IE1.LocationURL);? //获取网址
????????? Memo1.Lines.Add((IE1.Document as IHtmlDocument2).body.outerHTML);? //获取源码
??????? end;
????? end;
??? end;
? end;
end;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读