I have a program that needs to wait for a web page to load completely. I do this by setting a global boolean variable when the document = DocumentComplete.
VB Code:
Public Function GotoWebPage(vWebPage as string) as boolean wb.Navigate = vWebPage wpReadyFlag = False Do While wpReadyFlag = False DoEvents Loop End Function Private Sub wb_DocumentComplete(ByVal pDisp As Object, URL As Variant) If wb.ReadyState = READYSTATE_COMPLETE Then wpReadyFlag = True End If End Sub
When this runs (and it runs many many times) the processor spikes to 100% for the duration of the page load. Is there something else I can do instead of "DoEvents"?




Reply With Quote