[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;