Solved

Using Webbrowser Control in VB 5.0

Posted on 1998-07-30
5
132 Views
Last Modified: 2010-05-03
I am writing an application in VB 5.0 that will navigate a large web site using the webbrowser control.  After I make a call to the navigate method I would like to know when the web page is done loading.  I can catch the code in the DocumentComplete event, however I would like the control in my code to be back where I called the navigate in the first place.  Is there a way that I can signal an object and waitforsingleobject after the call to navigate.  I called Microsoft and they suggested that I put a Do Loop with a DoEvents inside after my call to navigate and then check a flag, which would get set in the document complete event function.  I tried this and it worked but it maxes out the cpu.  Any suggestions?
0
Comment
Question by:cwayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:clifABB
ID: 1467295
Don't call DoEvents() in every instance of the loop.  Try every 10 instances as such:

nLoopCount = 0
Do Until m_bLoadDone
  If nLoopCount > 9 Then
    DoEvents
    nLoopCount = 0
  End If
  nLoopCount = nLoopCount + 1
Loop
0
 

Author Comment

by:cwayne
ID: 1467296
I tried your suggestion and still have the same results.  It seems that even though you are in the loop doing nothing the cpu places the same priority on doing the nothing task as performing its other task(navigating to the web site) hence slowing the system down.  Any other suggestions?
0
 
LVL 6

Expert Comment

by:clifABB
ID: 1467297
The only other thin I can think of is:
Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
  DoEvents
Loop

This is a bit cleaner than setting a flag in the DocumentComplete event (and you don't have to test to set the flag each time).

Give this a try and see what happens.
0
 

Author Comment

by:cwayne
ID: 1467298
OK,

I accept that answer

Thanks
0
 
LVL 6

Accepted Solution

by:
clifABB earned 100 total points
ID: 1467299
Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
  DoEvents
Loop

I'm glag I could help you out.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
passing parameter in sql procedure 9 70
vb6 connector to mongodb 2 160
Child Form in front 4 65
Excel 2007 Random Generate List Based on Defined Source Cells 3 28
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question