[風鈴夜思雨]的方法只能取出一部分源码(BODY部分)
试试下面的吧,要给分哦:
function GetHtml(const WebBrowser: TWebBrowser): String;
var
Doc :IHTMLDocument2;
Elements :IHTMLElementCollection;
Item :IHTMLElement;
mLen,i :integer;
begin
Doc := WebBrowser.Document as IHTMLDocument2;
if Doc = nil then Exit;
Elements:= Doc.all as IHTMLElementCollection;
mLen:=Elements.length;
for i:= 0 to mLen - 1 do
begin
Item:=Elements.Item(i,'') as IHTMLElement;
if uppercase(Item.tagName) = 'HTML' then
begin
Result:=Item.OuterHtml;
Break;
end;
end;
end;