Article View: borland.public.cppbuilder.internet.web
Article #753Re: Getting TCppWebBrowser as Text From Stream
From: Remy Lebeau (TeamB)
Date: Thu, 09 Mar 2006 08:35
Date: Thu, 09 Mar 2006 08:35
41 lines
2004 bytes
2004 bytes
"caleb" <no@spam.com> wrote in message
news:440f9e16$1@newsgroups.borland.com...
> Can someone post code for getting the source of a
> TCppWebBrowser doc?
Such code has been posted many times before. Please go to
http://www.deja.com and search through the newsgroup archives.
> I have been using this code to get text from stream but it
> does not always work (on complex pages it only gets part
> of the html):
When exactly are you calling that code? Did you verify that the entire
document is actually available yet?
Try this code instead:
#include <mshtml.h>
#include <utilcls.h>
#include <memory>
AnsiString Source;
TComInterface<IHTMLDocument2> htm = wb->Document;
if( htm )
{
TComInterface<IPersistStreamInit> psi = htm;
if( psi )
{
std::auto_ptr<TStringStream> Stream(new TStringStream(""));
std::auto_ptr<TStreamAdapter> Adapter(new
TStreamAdapter(Stream.get(), soReference));
OleCheck(psi->Save(*Adapter, TRUE));
Source = Stream->DataString;
}
}
Gambit
Technical Details
Message-ID:
<440fe89f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<440f9e16$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,274260257bdc682e X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.web References: <440f9e16$1@newsgroups.borland.com> Subject: Re: Getting TCppWebBrowser as Text From Stream Date: Thu, 9 Mar 2006 00:35:47 -0800 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <440fe89f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1141893279 68.69.17.41 (9 Mar 2006 00:34:39 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail