Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to store the HTML source of a TWebBrowser programmatically Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
25-Aug-02
Category
ActiveX
Language
Delphi 5.x
Views
153
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Using the TWebBrowser component (Delphi 5), I am looking for a way to store the 
HTML code of the TWebBrowser. When I use the right mouse button, I can store the 
HTML code, but I would like to do this programmatically.

Answer:

1   uses
2     ActiveX;
3   
4   {Saves the HTML document - referenced through 'Document' - to a stream}
5   
6   procedure SaveDocumentSourceToStream(Document: IDispatch; Stream: TStream);
7   var
8     PersistStreamInit: IPersistStreamInit;
9     StreamAdapter: IStream;
10  begin
11    {Delete content of stream}
12    Stream.Size := 0;
13    Stream.Position := 0;
14    {IPersistStreamInit - get document interface}
15    if Document.QueryInterface(IPersistStreamInit, PersistStreamInit) = S_OK then
16    begin
17      {Use StreamAdapter to get the IStream interface for our stream}
18      StreamAdapter := TStreamAdapter.Create(Stream, soReference);
19      {Save data from document into stream}
20      PersistStreamInit.Save(StreamAdapter, False);
21      {Destroy StreamAdapter. Optional.}
22      StreamAdapter := nil;
23    end;
24  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC