就是microsoft internet transfer control 控件。msinet.ocx
可以!在它的俩个事件里写,看看我的例子: Private Sub WebBrowser1_StatusTextChange(ByVal Text As String) On Error GoTo eee If InStr(Text, "完成") <> 0 And WebBrowser1.Visible = True Then If WebBrowser1.Visible = False Then WebBrowser1.Visible = True If InStr(Text, "shdoclc.dll") <> 0 And Web1.Visible = True Then WebBrowser1.Stop msgbox“网页未找到!” Exit Sub End If End Ifeee: End Sub Private Sub WebBrowser1_TitleChange(ByVal Text As String) If WebBrowser1.Visible = False Then WebBrowser1.Visible = True If (InStr(Text, "找不到") <> 0 Or InStr(Text, "无法") <> 0 Or InStr(Text, "错误") <> 0 Or InStr(Text, "Socket") <> 0 Or InStr(Text, "取消") <> 0 Or InStr(Text, "没有") <> 0) And WebBrowser1.Visible = True Then WebBrowser1.Visible = False errorlog = writeerrorlog("", "WEB页面" & g_webstr & "未找到!") Exit Sub ElseIf WebBrowser1.LocationName = "hello world" Then //”hello world“ 为网页的标题 WebBrowser1.Visible = True End IfEnd Sub
to: platinumkill(bb) ( ) 信誉:100 真的可以吗?你试一下浏览微软的站点,看看你的代码是否有效。Private Sub Command1_Click() WebBrowser1.Navigate "http://www.microsoft.com/killbillgates.html" End SubPrivate Sub WebBrowser1_StatusTextChange(ByVal Text As String) On Error GoTo eee If InStr(Text, "完成") <> 0 And WebBrowser1.Visible = True Then If WebBrowser1.Visible = False Then WebBrowser1.Visible = True If InStr(Text, "shdoclc.dll") <> 0 And Web1.Visible = True Then WebBrowser1.Stop MsgBox "网页未找到!" Exit Sub End If End Ifeee: End Sub Private Sub WebBrowser1_TitleChange(ByVal Text As String) If WebBrowser1.Visible = False Then WebBrowser1.Visible = True If (InStr(Text, "找不到") <> 0 Or InStr(Text, "无法") <> 0 Or InStr(Text, "错误") <> 0 Or InStr(Text, "Socket") <> 0 Or InStr(Text, "取消") <> 0 Or InStr(Text, "没有") <> 0) And WebBrowser1.Visible = True Then WebBrowser1.Visible = False 'errorlog = writeerrorlog("", "WEB页面" & g_webstr & "未找到!") Exit Sub ElseIf WebBrowser1.LocationName = "hello world" Then '//”hello world“ 为网页的标题 WebBrowser1.Visible = True End IfEnd Sub
to TechnoFantasy(www.applevb.com) 如果网站自己做了404Error页面,服务器端会自己redirect到该页面。 Response.Redirect以及jsp/asp.net等等语言中的redirect这样的方法,将让WebServer在http header中返回一个remove to ...的header。 虽然对于WebBrowser的显示来说页面的确还是有的,但是已经是另外一个页面(错误处理页面),没错。可是由于有这个Header的存在,你还是可以捕捉到的: Private Sub WebBrowser1_NavigateError(ByVal pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean) 如果 StatusCode = 404 说明找不到,403拒绝访问 ....
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
On Error GoTo eee
If InStr(Text, "完成") <> 0 And WebBrowser1.Visible = True Then
If WebBrowser1.Visible = False Then WebBrowser1.Visible = True
If InStr(Text, "shdoclc.dll") <> 0 And Web1.Visible = True Then
WebBrowser1.Stop
msgbox“网页未找到!”
Exit Sub
End If
End Ifeee:
End Sub
Private Sub WebBrowser1_TitleChange(ByVal Text As String)
If WebBrowser1.Visible = False Then WebBrowser1.Visible = True
If (InStr(Text, "找不到") <> 0 Or InStr(Text, "无法") <> 0 Or InStr(Text, "错误") <> 0 Or InStr(Text, "Socket") <> 0 Or InStr(Text, "取消") <> 0 Or InStr(Text, "没有") <> 0) And WebBrowser1.Visible = True Then
WebBrowser1.Visible = False
errorlog = writeerrorlog("", "WEB页面" & g_webstr & "未找到!")
Exit Sub
ElseIf WebBrowser1.LocationName = "hello world" Then
//”hello world“ 为网页的标题
WebBrowser1.Visible = True
End IfEnd Sub
真的可以吗?你试一下浏览微软的站点,看看你的代码是否有效。Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.microsoft.com/killbillgates.html"
End SubPrivate Sub WebBrowser1_StatusTextChange(ByVal Text As String)
On Error GoTo eee
If InStr(Text, "完成") <> 0 And WebBrowser1.Visible = True Then
If WebBrowser1.Visible = False Then WebBrowser1.Visible = True
If InStr(Text, "shdoclc.dll") <> 0 And Web1.Visible = True Then
WebBrowser1.Stop
MsgBox "网页未找到!"
Exit Sub
End If
End Ifeee:
End Sub
Private Sub WebBrowser1_TitleChange(ByVal Text As String)
If WebBrowser1.Visible = False Then WebBrowser1.Visible = True
If (InStr(Text, "找不到") <> 0 Or InStr(Text, "无法") <> 0 Or InStr(Text, "错误") <> 0 Or InStr(Text, "Socket") <> 0 Or InStr(Text, "取消") <> 0 Or InStr(Text, "没有") <> 0) And WebBrowser1.Visible = True Then
WebBrowser1.Visible = False
'errorlog = writeerrorlog("", "WEB页面" & g_webstr & "未找到!")
Exit Sub
ElseIf WebBrowser1.LocationName = "hello world" Then
'//”hello world“ 为网页的标题
WebBrowser1.Visible = True
End IfEnd Sub
如果网站自己做了404Error页面,服务器端会自己redirect到该页面。
Response.Redirect以及jsp/asp.net等等语言中的redirect这样的方法,将让WebServer在http header中返回一个remove to ...的header。
虽然对于WebBrowser的显示来说页面的确还是有的,但是已经是另外一个页面(错误处理页面),没错。可是由于有这个Header的存在,你还是可以捕捉到的:
Private Sub WebBrowser1_NavigateError(ByVal pDisp As Object, URL As Variant, Frame As Variant, StatusCode As Variant, Cancel As Boolean)
如果 StatusCode = 404 说明找不到,403拒绝访问 ....
你在吗?WebBrowser1_NavigateError事件怎么在我的webbrowser控件中没有