das müsste so aussehen
in die uses muss noch SHDocVw, MSHTML und
ActiveX glaube ich
Delphi-Quellcode:
tempBodyStream:=TStringStream.Create(tempbody);
LoadFromStream(ieControl, tempBodyStream);
tempBodyStream.Destroy;
procedure LoadFromStream(Dest:TWebBrowser;const Stream: TStream);
var
Flags: OleVariant;
i:integer;
begin
Flags:=navNoHistory or navNoReadFromCache or navNoWriteToCache;
if not Assigned(Dest.Document) then
Dest.Navigate('about:blank',Flags);
i:=0;
if Dest.Showing then
while (Dest.ReadyState <> READYSTATE_COMPLETE) do begin
Application.ProcessMessages;
Sleep(1);
inc(i);
if i>2500 then break;
end;
try
InternalLoadDocumentFromStream(Dest,Stream);
except
end;
end;
procedure InternalLoadDocumentFromStream(Dest:TWebBrowser;const Stream: TStream);
var
PS: IPersistStreamInit;
StreamA: TStreamAdapter;
//Doc:IHTMLDocument2;
ret:HResult;
begin
if Dest=nil then exit;
if not assigned(Dest.Document) then exit;
//Doc:=Dest.Document as IHTMLDocument2;
PS:= Dest.Document as IPersistStreamInit;
// StreamA:=NIL;
try
try
ret := PS.InitNew;
if SUCCEEDED(ret) then
begin
StreamA := TStreamAdapter.Create(Stream);
PS.Load(StreamA);
end;
finally
//Stream.Free;
//if StreamA <> nil then IUnknown(StreamA)._Release;
end;
finally
//if PS <> nil then PS._Release;
end;
end;