πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Get the html content from WebBrowser

#369
From: sam
Date: Wed, 13 Dec 2006 14:36
8 lines
2043 bytes
Here the complete code that works fine using Turbo C++ 2006:
It reads the TWebBrowser content and save it to a file:

#include <mshtml.h>

 IHTMLDocument2 *HTMLDocument = NULL;

 if(SUCCEEDED(Web->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&HTMLDocument))) {  IHTMLElement *HTMLBody = NULL;  if(SUCCEEDED(HTMLDocument->get_body(&HTMLBody))){   BSTR HTMLSource;   if(SUCCEEDED(HTMLBody->get_outerHTML(&HTMLSource))){    TStringList *list = new TStringList();    list->Text = WideString(HTMLSource);    list->SaveToFile("c:\\HTMLFile.html");    delete list;list=NULL;   }   HTMLBody->Release();  }  HTMLDocument->Release(); }Sam"sam" <nospam@nospam.com> a οΏ½crit dans le message de news:457fbb89@newsgroups.borland.com...>I am using the new Turbo C++ and I need to get html content from aWebBrowser control.> I have search on the newsgroup but I have not found it.> I use:> WideString Url="www.google.fr";> WebBrowser1->Navigate(Url);Now waht is the simplest way for hetting thehtml ?> Thanks;> Sam>
Technical Details
Message-ID: <45800fd4@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <457fbb89@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,7aeaf19e862fe0eb
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
Reply-To: "sam" <nospam@nospam.com>
From: "sam" <nospam@nospam.com>
Newsgroups: borland.public.cppbuilder.internet.web
References: <457fbb89@newsgroups.borland.com>
Subject: Re: Get the html content from WebBrowser
Date: Wed, 13 Dec 2006 14:36:59 -0000
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: 41.207.160.92
Message-ID: <45800fd4@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1166020564 41.207.160.92 (13 Dec 2006 06:36:04 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!news2.euro.net!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail