Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I get raw HTML from WebBrowser control in VB6?

73 views
Skip to first unread message

Patrick Avery

unread,
Jun 23, 1999, 3:00:00 AM6/23/99
to
I am trying to get at the raw HTML of the current page displayed in a
WebBrowser control. I tried putting wbcontrol.Document.Body into a text
box but it comes out [object]. I am able to get the title with
wbcontrol.Document.Title but the body eludes me. Does anyone know of a
sample of this that I can look at?

Thanks, Pat Avery

Thomas Ganss

unread,
Jun 24, 1999, 3:00:00 AM6/24/99
to
Hi Patrick,

.Document.Body.Innerhtml will get you the raw HTML of the body.

If you need the whole page (with scripts in the HEADER and so on)
you must use the IPersist*-Interfaces.

HTH

Thomas

Patrick Avery schrieb in Nachricht <37715CF8...@research-tank.com>...

Barry Evans

unread,
Jun 27, 1999, 3:00:00 AM6/27/99
to
For Ie4, this cannot be done with functionality native to VB and/or IE. See
Thomas Ganss reply in this thread for the compromise. He used to make
available on his site a library which helped to do this, but I can't
remember the site name.

For Ie5, it's a breeze!

'
' Requires "Project/References" to
' Microsoft HTML Object Library (MSHTML.tlb)
'
' =============================================
Dim HTMLDoc As MSHTML.HTMLDocument
Dim oHTML As MSHTML.HTMLHtmlElement
Dim strHTML As String

Set HTMLDoc = wbr.Document ' wbr = WebBrowser Control
Set oHTML = HTMLDoc.getElementsByTagName("HTML")(0)
strHTML = oHTML.outerHTML ' <== it's here
' =============================================
--
Barry Evans
Canberra, Australia
-
Patrick Avery <paver...@research-tank.com> wrote in message
news:37715CF8...@research-tank.com...

Thomas Ganss

unread,
Jun 27, 1999, 3:00:00 AM6/27/99
to
Well...

Barry Evans schrieb in Nachricht ...


>For Ie4, this cannot be done with functionality native to VB and/or IE. See
>Thomas Ganss reply in this thread for the compromise. He used to make
>available on his site a library which helped to do this, but I can't
>remember the site name.

it wasn't my but Ben Baird's typelib for IPersistfile.

I only realized that it would solve that particular problem for VB.
You can also go via c++ for IPersistStreamInit or IPersistFile
without any .tlb's and create a dll to call from VB.


I am not sure wether Ben put the lib up again on
VBThunder.Com, (recommended anyway),
but he sent it in a few weeks ago for a similar question.


Since it isn't my work, I don't feel free to send it to you,
and always posting would mean unnecessary traffic on the net.

But you can definitely find it in deja searching
for Ben's name from his earlier posting...


HTH

Thomas


0 new messages