Solved

how load a stream from a html stream in TWebBrowser?

Posted on 2003-11-09
2
227 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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