Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how load a stream from a html stream in TWebBrowser?

Posted on 2003-11-09
2
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

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

Accepted Solution

by:
EddieShipman earned 300 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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