VB 判断 WebBrowser是否已经加载网页完毕

前端之家收集整理的这篇文章主要介绍了VB 判断 WebBrowser是否已经加载网页完毕前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、

Private Sub Form_Load()
WebBrowser1.navigate "http://blog.csdn.net/lbuskeep"

Do
DoEvents

If Not WebBrowser1.Busy And WebBrowser1.LocationURL <> "http://blog.csdn.net/lbuskeep" Then
MsgBox "OK"

Exit Do

End If

Loop

End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object,Url As Variant)

If (pDisp Is WebBrowser1.Object) Then
MsgBox WebBrowser1.LocationURL
End If

End Sub

2、

Private Sub WebBrowser_DocumentComplete(ByVal pDisp As Object,URL As Variant) '获得网页标题 If Not WebBrowser.Busy Then '判断网页是否下载完毕 Dim strTitle As String strTitle = WebBrowser.Document.DocumentElement.InnerHtml strTitle = Mid(strTitle,1,InStr(1,LCase(strTitle),"</title>") - 1) strTitle = Mid(strTitle,"<title>") + 7) Me.Caption = strTitle End If End Sub

原文链接:https://www.f2er.com/vb/261432.html

猜你在找的VB相关文章