Results 1 to 6 of 6

Thread: WebBrowser Events

  1. #1

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Question WebBrowser Events

    At the top of almost all the pages in VBForums.com, there are links for internet.com. When the mouse is hovered over some of these links like IT, Developer, News etc., a drop-down menu pops-up.

    When I open a VBForums page in a browser which I have created using the WebBrowser control & hover the mouse over any of these links, the drop-down menu pops-up....that's fine but strangely the DownloadBegin & DownloadComplete events of the WebBrowser control also fire each time the mouse is moved over such links!

    Now why are these 2 events firing when the mouse is moved over such links?

    As it is, on most occasions, the DocumentComplete event fires more than once; that's the reason I thought of making use of the DownloadComplete event but this event behaves insanely!


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: WebBrowser Events

    I've been playing with WebBrowser as a result of another thread, you may find it interesting: http://www.vbforums.com/showthread.php?t=504545 as far as the DocumentComplete event is concerned. As to the DownLoadBegin and Complete activity, I don't see that happening.

  3. #3

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: WebBrowser Events

    You mean you don't see the DownloadBegin & DownloadComplete events firing more than once? If yes, have you tried navigating to this forum using the WebBrowser control?

    If a web page loads very fast (like www.google.com), then these 2 events fire only once but if a web page takes some time to download, then these 2 events fire multiple times.


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  4. #4
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: WebBrowser Events

    No, I don't see those events triggering when I hover the mouse over the Internet.com menu items.

    When navigating to the home page of this site using http://www.vbforums.com/ two http requests are actually generated so there will be two DownLoadBegin and DownLoadComplete events. (Plus 2 of most of the other events associated with navigation)

    The code I posted in the thread referenced earlier uses the WebBrowser control to demonstrate - perhaps you could try it and see.

  5. #5

    Thread Starter
    Frenzied Member arpan_de's Avatar
    Join Date
    Oct 2005
    Location
    Mumbai, India
    Posts
    1,394

    Re: WebBrowser Events

    You are very much correct that it makes 2 HTPPP requests but how did you come to the conclusion that it sends 2 HTTP requests?


    ARPAN

    IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!

    NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!

    PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: WebBrowser Events

    Past experience with writing 'screen-scraping' applications and having long nights wondering why sometimes the DocumentComplete event seemed to trigger to early. I still haven't found a 100% reliable method of determining when the Document requested is loaded properly.

    Using in-line Error Handling is probably the easiest circumvention, check if an Error of "Object Variable with Block Variable Not Set" is returned, if it is then go round a loop until it isn't, if there isn't an error then you know the Document is ready.

    Whenever I start out on these types of Applications I usually go through the process of 'debug.print'ing the output from the Navigation events for the particular pages I'm interested in (as per that code I posted in the other thread) so I have a reasonable idea of what I'm up against.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width