Search Tools Links Login

You too can access all the properties/methods/events of the webbrowser + html object w/o 1 control!!


How you can access all the properties, methods, and
events of the html object libray/webbrowser control
with using any webbrowser or winsock or inet control.
Most people believe that in order to use these objects
you have to load some sort of browser object
into memory..which has always been problem for me
since i know that IE has a lot of security holes.
the secret basically lies in one method of the
HTMLobject library. it is the ".CreateDocumentFromURl"
method
It goes something like this

Original Author: Evan Toder

Code



How you can access all the properties, methods, and

events of the html object libray/webbrowser control

with using any webbrowser or winsock or inet control.



Most people believe that in order to use these objects

you have to load some sort of browser object

into memory..which has always been problem for me

since i know that IE has a lot of security holes.



the secret basically lies in one method of the

HTMLobject library. it is the ".CreateDocumentFromURl"

method

It goes something like this





'

dim start_time as long

'

'

'set a reference to the

'Microsoft HTML object library

'

'========================================



sub GetDocObject(byval sUrl as string )

  dim objHTML as new htmlDocument

  dim objDoc  as htmlDocument



   set objDoc=objHtml.CreateObjectFromUrl(sUrl)



'we now have to wait for the document to be set

'you probably want some sort of time out

'value in case of unforseen network problems

'otherwise you caught in the dreaded hanging

'loop



   start_time = getTickCount 'API call



   while objDoc.readystate <> "complete"

       '5 second timeout value

      if (gettickcount - start_time) > 5000 then

           exit sub

      end if

      doevents

   wend



   'reaching this point in code means

   'the document object has been set

   'and you can handle it any way you

   'wish accessing its links, tables..whatever

   'for example



     dim lcnt as long

     dim upper as long

     dim oLink as htmlAnchorElement



     upper = objDoc.GetElementsByTagName("A").length -1



     if upper > 0 then



        for lcnt = 0 to upper-1

            set oLink = objDoc.GetElementsBytagName("A")(lcnt)

            list1.additem oLink.href

        next lcnty

     end if





end sub

  

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 90 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.