Skip to content

Planet-Source-Code/evan-toder-you-too-can-access-all-the-properties-methods-events-of-the-webbrowser-html-obj__1-58386

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

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

Description

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

More Info

Submitted On
By Evan Toder
Level Intermediate
User Rating 4.0 (12 globes from 3 users)
Compatibility VB 5.0, VB 6.0
Category Coding Standards
World Visual Basic
Archive File

Source 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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published