Solved

Using Webbrowser Control in VB 5.0

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 51
MsgBox 2 38
Visual Studio 2005 text editor 10 23
vb6 - Transfer from MSHFlexgrid1 to xls issue 8 16
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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now