Bei mir werden 20 msec ausgewiesen:
Delphi-Quellcode:
function myGetHTMLCode(WebBrowser: TWebBrowser; ACode: TStrings): Boolean;
var
ps : IPersistStreamInit;
ss : TStringStream;
sa : IStream;
s : string;
begin
Result := False;
if not Assigned(WebBrowser.Document) then Exit;
ps := WebBrowser.Document as IPersistStreamInit;
s := '';
ss := TStringStream.Create(s);
try
sa := TStreamAdapter.Create(ss, soReference) as IStream;
Result := Succeeded(ps.Save(sa, True));
if Result then
with ACode do
begin
BeginUpdate;
Text := ss.Datastring;
EndUpdate;
end;
finally
ss.Free;
end;
end;
procedure TDemoForm.tbnExtractClick(Sender: TObject);
var
s: TStrings;
tc: Cardinal;
begin
s := TStringList.Create;
tc := GetTickCount;
myGetHtmlCode(WebBrowser, s);
tc := GetTickCount - tc;
s.Free;
ShowMessage(Format('%.0n', [1.0 * tc]));
end;
procedure TDemoForm.tbnLoadClick(Sender: TObject);
begin
with WebBrowser do
Navigate('http://de.wikipedia.org');
end;
marabu