Solved

Using Webbrowser Control in VB 5.0

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pull multiple cvs files into one access table 28 64
Excel VBA combine two working workbooks 8 46
VB error "Type mismatch" 2 49
Problem to With line 4 36
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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

930 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

10 Experts available now in Live!

Get 1:1 Help Now