?
Solved

Using Webbrowser Control in VB 5.0

Posted on 1998-07-30
5
Medium Priority
?
134 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 300 total points
ID: 1467299
Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
  DoEvents
Loop

I'm glag I could help you out.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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 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…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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