这是我的一个察看源文件的方法:(curweb为TwebBrowser)
var
all:IHTMLElementcollection;
doc:IHTMLDocument2;
item:OleVariant;
s:string;
m:Tmemo;
begin
try
doc:=curweb.document as ihtmldocument2;
except
exit;
end;
all:=doc.all;
m:=tmemo.Create(main);
with m do
begin
parent:=panel3;
visible:=false;
lines.BeginUpdate;
lines.clear;
end;
item:=all.item(0,varEmpty);
m.lines.add(item.innerhtml);
s:=exepath+'temp.txt';
with m do
begin
lines.EndUpdate;
lines.savetofile(s);
free;
end;
shellExecute(handle,'open',pchar(s),nil,nil,sw_shownormal);
end;
给分吧。think you!