Warning: Undefined array key "HTTP_ACCEPT_LANGUAGE" in /www/wwwroot/01xj.net/wp-content/plugins/wp-ue/main.php on line 13
VB 判断 WebBrowser是否已经加载网页完毕 – 我的空间 · 我做主

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

1、

Private Sub Form_Load()
WebBrowser1.navigate “http://01xj.net

Do
DoEvents

If Not WebBrowser1.Busy And WebBrowser1.LocationURL <> “http://01xj.net” 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, InStr(1, LCase(strTitle), “<title>”) + 7)
Me.Caption = strTitle
End If
End Sub

您可能还喜欢...

发表回复