🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13224

Re: BHO question

#13224
From: Remy Lebeau (TeamB)
Date: Mon, 20 Oct 2003 20:20
43 lines
2940 bytes
"Martin C" <martinc@aol.com> wrote in message
news:3f941a75$1@newsgroups.borland.com...

> I always retrieve rubbish if any web site contains dhtml

You're going to have to be a little more specific.  "Rubbish" can mean any
number of things.  Lets also not forget that DHTML is not static like HTML
is (thus its name - Dynamic HTML) so some of its content may come from
elsewhere, or be generated via scripting.

>                                         WCHAR   *szText;
>                                         pHtml.p->toString(&szText);

You have a memory leak in that code, a you are never freeing the BSTR that
toString() returns.  I would suggest that you use  WideString instead:

    WideString wText;
    pHtml.p->toString(&wText);

With that said, you can't use your pHTML variable anyway because you did not
assign it yet before trying to access it, thus your code should crash.

If all you want to do is get the HTML for the document, then I would suggest
you use an IPersistStreamInit instead to stream the content into an IStream,
which you can then store into a TStream descendant (TMemoryStream,
TStringStream, etc) via the TStreamAdapter helper class, ie.

    #include <memory>

    CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> pPersist;
    pPersist = pADocument;
    if( pPersist )
    {
        std::auto_ptr<TStringStream> StrStrm(new TStringStream(""));
        std::auto_ptr<TStreamAdapter> Adapter(new
TStreamAdapter(StrStrm.get(), soReference));
        pPersist->Save(*Adapter, FALSE);
        // use StrStrm->DataString as needed
    }


Gambit
Technical Details
Message-ID: <3f944304$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f84957c@newsgroups.borland.com> <3f84a0b8@newsgroups.borland.com> <3f88b9db@newsgroups.borland.com> <3f88be72$1@newsgroups.borland.com> <3f897b9a@newsgroups.borland.com> <3f89c56f$1@newsgroups.borland.com> <3f8af683@newsgroups.borland.com> <3f8af95a$3@newsgroups.borland.com> <3f8affad@newsgroups.borland.com> <3f8b009f$3@newsgroups.borland.com> <3f8ed9f0$1@newsgroups.borland.com> <3f8edeb3$1@newsgroups.borland.com> <3f941a75$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,15b7dd6889830f4f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-20 13:25:36 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f84957c@newsgroups.borland.com> <3f84a0b8@newsgroups.borland.com> <3f88b9db@newsgroups.borland.com> <3f88be72$1@newsgroups.borland.com> <3f897b9a@newsgroups.borland.com> <3f89c56f$1@newsgroups.borland.com> <3f8af683@newsgroups.borland.com> <3f8af95a$3@newsgroups.borland.com> <3f8affad@newsgroups.borland.com> <3f8b009f$3@newsgroups.borland.com> <3f8ed9f0$1@newsgroups.borland.com> <3f8edeb3$1@newsgroups.borland.com> <3f941a75$1@newsgroups.borland.com>
Subject: Re: BHO question
Date: Mon, 20 Oct 2003 13:20:40 -0700
Lines: 45
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.137.75
Message-ID: <3f944304$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1066681092 67.22.137.75 (20 Oct 2003 13:18:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail