🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
14 messages
14 total messages Started by sam Wed, 13 Dec 2006 08:37
Get the html content from WebBrowser
#360
Author: sam
Date: Wed, 13 Dec 2006 08:37
9 lines
1290 bytes
I am using the new Turbo C++ and I need to get html content from a 
WebBrowser 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 the 
html ?
Thanks;
Sam 
Re: Get the html content from WebBrowser
#361
Author: Hans Galema
Date: Wed, 13 Dec 2006 09:12
13 lines
1295 bytes
sam wrote:
> I am using the new Turbo C++ and I need to get html content from a 
> WebBrowser control.
> I have search on the newsgroup but I have not found it.

Well how did you search?

It is about the most aswered question here.

Do you use already:
http://www.google.nl/advanced_group_search?hl=en

Hans.
Re: Get the html content from WebBrowser
#362
Author: sam
Date: Wed, 13 Dec 2006 09:29
23 lines
1699 bytes
> Well how did you search?

I have search by google newsgroup but the problem is that this WebBrowser 
control has not a unique way to get html content if you use BCB 4, 5 and 6 
or else.
So using the last version of BCB, can you direct me.
Sam

"Hans Galema" <notused@notused.nl> a �crit dans le message de news: 
457fc441$1@newsgroups.borland.com...
> sam wrote:
>> I am using the new Turbo C++ and I need to get html content from a 
>> WebBrowser control.
>> I have search on the newsgroup but I have not found it.
>
> Well how did you search?
>
> It is about the most aswered question here.
>
> Do you use already:
> http://www.google.nl/advanced_group_search?hl=en
>
> Hans. 
Re: Get the html content from WebBrowser
#363
Author: Hans Galema
Date: Wed, 13 Dec 2006 09:50
21 lines
1742 bytes
sam wrote:

> I have search by google newsgroup 

Should I consider that as 'yes' for my question about the link I gave you?

> but the problem is that this WebBrowser 
> control has not a unique way to get html content if you use BCB 4, 5 and 6 
> or else.

That is the first time I hear of that. I've used the same code for 3, 5 and now
Turbo C++. I also posted that code sometimes.

> So using the last version of BCB, can you direct me.

>>Do you use already:
>>http://www.google.nl/advanced_group_search?hl=en

The question is repeated.

Hans.
Re: Get the html content from WebBrowser
#364
Author: Hans Galema
Date: Wed, 13 Dec 2006 09:57
10 lines
1042 bytes
sam wrote:

> I use:
>  WideString Url="www.google.fr";

Are you sure?

	WideString Url="http://www.google.fr";

Hans.
Re: Get the html content from WebBrowser
#365
Author: sam
Date: Wed, 13 Dec 2006 11:34
20 lines
1405 bytes
> Are you sure?
>
> WideString Url="http://www.google.fr";
yes it works fine for loading an HTML page from url. Now I need to get this 
content in a file or a stream.
So what is the process if it is so simple ?

Sam
"Hans Galema" <notused@notused.nl> a �crit dans le message de news: 
457fcec4@newsgroups.borland.com...
> sam wrote:
>
>> I use:
>>  WideString Url="www.google.fr";
>
> Are you sure?
>
> WideString Url="http://www.google.fr";
>
> Hans. 
Re: Get the html content from WebBrowser
#366
Author: Hans Galema
Date: Wed, 13 Dec 2006 12:58
21 lines
1527 bytes
sam wrote:
>>Are you sure?
>>
>>WideString Url="http://www.google.fr";
> 
> yes it works fine for loading an HTML page from url.

That is a strange reaction on the correction I made.

> Now I need to get this 
> content in a file or a stream.
> So what is the process if it is so simple ?

You found solutions for 4, 5 and 6 you said.

Now which is unusable for 'the last version of BCB'?

And did you use the link I provided? Why don't you answer that
question? With that link you will find many solutions.

Hans.
Re: Get the html content from WebBrowser
#367
Author: sam
Date: Wed, 13 Dec 2006 13:10
28 lines
2000 bytes
Hans, sorry for the confusion, I mean that WideString 
Url="http://www.google.fr" or WideString Url="www.google.fr" works fine, and 
the control play this url and display the content.
Now, I need to retrieve this content for working with it. That is my issue !

Sam
"Hans Galema" <notused@notused.nl> a �crit dans le message de news: 
457ff932$1@newsgroups.borland.com...
> sam wrote:
>>>Are you sure?
>>>
>>>WideString Url="http://www.google.fr";
>>
>> yes it works fine for loading an HTML page from url.
>
> That is a strange reaction on the correction I made.
>
>> Now I need to get this content in a file or a stream.
>> So what is the process if it is so simple ?
>
> You found solutions for 4, 5 and 6 you said.
>
> Now which is unusable for 'the last version of BCB'?
>
> And did you use the link I provided? Why don't you answer that
> question? With that link you will find many solutions.
>
> Hans. 
Re: Get the html content from WebBrowser
#368
Author: Hans Galema
Date: Wed, 13 Dec 2006 13:35
14 lines
1503 bytes
sam wrote:

> Url="http://www.google.fr" or WideString Url="www.google.fr" works fine, and 
> the control play this url and display the content.

Hmm.. You are right. Both work. My mistake. Sorry for that.

> Now, I need to retrieve this content for working with it. That is my issue !

I know.

What code did you find for "GetSource" in "*cppbuilder*"?

Hans.
Re: Get the html content from WebBrowser
#369
Author: 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>
Re: Get the html content from WebBrowser
#370
Author: Hans Galema
Date: Wed, 13 Dec 2006 15:00
8 lines
1291 bytes
sam wrote:
> Here the complete code that works fine using Turbo C++ 2006:
> It reads the TWebBrowser content and save it to a file:

FYI: HTMLBody->get_outerHTML() only gives you the contents between
<body>...</body> not all between <html>...<html> which you asked for.

Hans.
Re: Get the html content from WebBrowser
#371
Author: sam
Date: Wed, 13 Dec 2006 15:10
15 lines
1531 bytes
> FYI: HTMLBody->get_outerHTML() only gives you the contents between
You are wright !
If you have the code for getting the complete file, you are welcome.

Sam
"Hans Galema" <notused@notused.nl> a �crit dans le message de news: 
458015ca$1@newsgroups.borland.com...
> sam wrote:
>> Here the complete code that works fine using Turbo C++ 2006:
>> It reads the TWebBrowser content and save it to a file:
>
> FYI: HTMLBody->get_outerHTML() only gives you the contents between
> <body>...</body> not all between <html>...<html> which you asked for.
>
> Hans. 
Re: Get the html content from WebBrowser
#372
Author: Hans Galema
Date: Wed, 13 Dec 2006 15:18
7 lines
1165 bytes
sam wrote:

> If you have the code for getting the complete file, you are welcome.

Yes I have. And I told you how to find it.

Hans.
Re: Get the html content from WebBrowser
#373
Author: Enrique
Date: Wed, 13 Dec 2006 16:01
65 lines
3092 bytes
Hi sam !

Here is the code that I use:
//-----------------------------------------------------------
AnsiString TInternetExplorer::CodigoFuenteHTML(TCppWebBrowser* 
CppWebBrowser1)
{
  AnsiString Source = "";

  IHTMLDocument2 *htm = NULL;     // #include <mshtml.h>


if(CppWebBrowser1->Document&&SUCCEEDED(CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,
(LPVOID*)&htm)))
    {
    IPersistStreamInit *spPsi = NULL;    // ocidl.h


if(SUCCEEDED(htm->QueryInterface(IID_IPersistStreamInit,(LPVOID*)&spPsi)) && 
spPsi)
       {
            IStream *spStream = NULL;            // objidl.h
            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));
                OleCheck(spStream->Release());
            }

            spPsi->Release();
        }
    htm->Release();
    }
   return Source;
}
//------------------------------------------------------------------------

I now that it's more easy just ask to a group and wait for the answer, but 
if you give the custom of searching you will win much more than a code and a 
rapid solution for that unique and specific problem.

bye !
enrique.

"Hans Galema" <notused@notused.nl> escribi� en el mensaje 
news:45801a0f@newsgroups.borland.com...
> sam wrote:
>
>> If you have the code for getting the complete file, you are welcome.
>
> Yes I have. And I told you how to find it.
>
> Hans. 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads