Solved

Using Webbrowser Control in VB 5.0

Posted on 1998-07-30
5
131 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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