Solved

how load a stream from a html stream in TWebBrowser?

Posted on 2003-11-09
2
230 Views
Last Modified: 2010-04-05
procedure TForm1.Button8Click(Sender: TObject);
var
  LPersistStreamInit: IPersistStreamInit;
  LMemoryStream: TMemoryStream;
  fm: TFileStream;
begin
  LMemoryStream := TMemoryStream.Create;
  try
    LPersistStreamInit := WebBrowser1.Document as IPersistStreamInit;
    fm := TFileStream.Create('d:\h.htm', fmopenread or fmshareexclusive);
    //LMemoryStream.CopyFrom(fm, 0); //if use this sent,no result
    LMemoryStream.Position := 0;
    LPersistStreamInit.Load(TStreamAdapter.Create(fm));
  finally
    LMemoryStream.Free;
  end;
end;

this can show 'd:\h.htm' html source,but not show the html like  " WebBrowser1.Navigate('d:\h.htm');"
how can i do!
thanks!
0
Comment
Question by:jbas
2 Comments
 

Author Comment

by:jbas
ID: 9721179
who can help me?
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 100 total points
ID: 9737230
function TForm1.LoadFromStream(const AStream: TStream): HRESULT;
begin
  AStream.seek(0, 0);
  Result := (WebBrowser1.Document as IPersistStreamInit).Load(TStreamAdapter.Create(AStream));
end;

From http://www.members.shaw.ca/iedelphi/webbrowser.htm#advanced5
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Yen format 3 59
tvirtualstringtree freeze when load too manny images 10 80
DBCtrlGrid, Delphi, Scroll 8 58
shape, triangle, dbctrlgrid 3 31
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question