🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

TCPPWebBrowser and obtaining source after changing

#48
From: Tom
Date: Tue, 13 Mar 2007 21:11
44 lines
2084 bytes
After modifying the source by using IHTMLDOMNode to insert a new node the 
source code that's returned does not reflect this change (what's shown in 
the browser is correct). What is the proper method for obtaining the new 
source? Right now I'm the code below which was obtained from the archives 
and slightly modified.

Thanks,

Tom

  AnsiString Source = "";


  TComInterface<IHTMLDocument2> htm;

  if(Browser->Document && 
SUCCEEDED(Browser->Document->QueryInterface(IID_IHTMLDocument2, 
(LPVOID*)&htm)))
  {
    TComInterface<IPersistStreamInit> spPsi;

    if(SUCCEEDED(htm->QueryInterface(IID_IPersistStreamInit, 
(LPVOID*)&spPsi)))
    {
      TComInterface<IStream> spStream;
      OleCheck(CreateStreamOnHGlobal(NULL, true, &spStream));
      if(spStream)
      {
        __int64 nSize = 0;
        STATSTG ss;
        LARGE_INTEGER nMove;
        nMove.QuadPart = 0;
        OleCheck(spPsi->Save(spStream, true));
        OleCheck(spStream->Seek(nMove, STREAM_SEEK_SET, 
(ULARGE_INTEGER*)&nSize));
        OleCheck(spStream->Stat(&ss, STATFLAG_NONAME));
        nSize = ss.cbSize.QuadPart;

        Source.SetLength(nSize);
        OleCheck(spStream->Read((void *)Source.data(), nSize, 
(ULONG*)&nSize));
      }
    }
  } 
Technical Details
Message-ID: <45f70570@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,63670a97ac142f40,start
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Tom" <tom@nospam.net>
Newsgroups: borland.public.cppbuilder.internet.web
Subject: TCPPWebBrowser and obtaining source after changing
Date: Tue, 13 Mar 2007 15:11:32 -0600
Lines: 46
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: 68.1.78.156
Message-ID: <45f70570@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1173816688 68.1.78.156 (13 Mar 2007 13:11:28 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail