1、 Private Sub Form_Load()
WebBrowser1.navigate "http://www.52pojie.cn" Do
DoEvents If Not WebBrowser1.Busy And WebBrowser1.LocationURL <> "http://www.52pojie.cn" 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
|