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;
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;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。