Solved

how load a stream from a html stream in TWebBrowser?

Posted on 2003-11-09
2
222 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
Comment Utility
who can help me?
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 100 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now