?
Solved

how load a stream from a html stream in TWebBrowser?

Posted on 2003-11-09
2
Medium Priority
?
237 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month12 days, left to enroll

752 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