🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #444

Re: How to get the "real live" HTML source?

#444
From: Enrique
Date: Thu, 28 Dec 2006 19:34
86 lines
4246 bytes
What type of smart pointers? classes created by you or using auto_ptr?
I think I never used smart pointers...

So... should I use this code (for example):
//---------------------------------------------------------------------------------------------
AnsiString TInternetExplorer::CodigoFuenteRealLive(TCppWebBrowser* 
MyCppWebBrowser)
{
  AnsiString Source = "";
  if( MyCppWebBrowser->Document )
  {
    TComInterface<IHTMLDocument2> Doc;
    MyCppWebBrowser->Document->QueryInterface(IID_IHTMLDocument2, 
(LPVOID*)&Doc);
    if( Doc )
    {
           TComInterface<IHTMLElementCollection> All;
           Doc->get_all(&All);
           if( All )
           {
                TVariant ItemName(L"TimeLeft", false);
                TVariant ItemIndex = 0;
                TComInterface<IDispatch> Disp;
                All->item(ItemName, ItemIndex, &Disp);
                if( Disp )
                {
                     TComInterface<IHTMLElement> Element;
                     Disp->QueryInterface(IID_IHTMLElement,(LPVOID*)&Element);
                     if( Element )
                     {
                         WideString text;
                         Element->get_innerText(&text);
                         Source = text;
                     }
                }
           }
    }
  }
 return Source;
}
//----------------------------------------------------------------------

or this instead?
(changes marked with /** new **/
//---------------------------------------------------------------------------------------------
AnsiString TInternetExplorer::CodigoFuenteRealLive(TCppWebBrowser* 
MyCppWebBrowser)
{
  AnsiString Source = "";
  if( MyCppWebBrowser->Document )
  {
    TComInterface<IHTMLDocument2> Doc;
    MyCppWebBrowser->Document->QueryInterface(IID_IHTMLDocument2, 
(LPVOID*)&Doc);
    if( Doc )
    {
           TComInterface<IHTMLElementCollection> All;
           Doc->get_all(&All);
           Doc->Release();    /** new **/
           if( All )
           {
                TVariant ItemName(L"TimeLeft", false);
                TVariant ItemIndex = 0;
                TComInterface<IDispatch> Disp;
                All->item(ItemName, ItemIndex, &Disp);
                if( Disp )
                {
                     TComInterface<IHTMLElement> Element;
                     Disp->QueryInterface(IID_IHTMLElement,(LPVOID*)&Element);
                     Disp->Release();    /** new **/
                     if( Element )
                     {
                         WideString text;
                         Element->get_innerText(&text);
                         Source = text;
                         Element->Release();    /** new **/
                     }
                }
           }
    }
  }
 return Source;
}
//----------------------------------------------------------------------

enrique.
Technical Details
Message-ID: <45941c1c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4582e657@newsgroups.borland.com> <4582eb35$1@newsgroups.borland.com> <45831d53@newsgroups.borland.com> <4583480c$1@newsgroups.borland.com> <45834aa4$1@newsgroups.borland.com> <4583eee0@newsgroups.borland.com> <4586f05a$1@newsgroups.borland.com> <4588092d@newsgroups.borland.com> <458830cd$1@newsgroups.borland.com> <45940667@newsgroups.borland.com> <45940db0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,b54437b3b496861e
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Enrique" <enridp@yahoo.com.ar>
From: "Enrique" <enridp@yahoo.com.ar>
Newsgroups: borland.public.cppbuilder.internet.web
References: <4582e657@newsgroups.borland.com> <4582eb35$1@newsgroups.borland.com> <45831d53@newsgroups.borland.com> <4583480c$1@newsgroups.borland.com> <45834aa4$1@newsgroups.borland.com> <4583eee0@newsgroups.borland.com> <4586f05a$1@newsgroups.borland.com> <4588092d@newsgroups.borland.com> <458830cd$1@newsgroups.borland.com> <45940667@newsgroups.borland.com> <45940db0$1@newsgroups.borland.com>
Subject: Re: How to get the "real live" HTML source?
Date: Thu, 28 Dec 2006 16:34:08 -0300
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 190.30.251.130
Message-ID: <45941c1c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1167334428 190.30.251.130 (28 Dec 2006 11:33:48 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail