[delphi WebBrowser] WebBrowser 提取html源码

uses mshtml;

procedure TForm1.wb1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant);
var
i:Integer;
iall : IHTMLElement;
begin
if wb1.Application = pDisp then
begin
mmo1.Clear;
if Assigned(wb1.Document) then
begin
iall := (wb1.Document AS IHTMLDocument2).body;
while iall.parentElement <> nil do
begin
iall := iall.parentElement;
end;
mmo1.Text := mmo1.Text+iall.outerHTML;
end;
end;
end;

Last modification:January 31st, 2013 at 03:49 pm
如果觉得我的文章对你有用,请随意赞赏