我的做法,顶!别沉
'程序编程:[url]http://hi.baidu.com/buxchang[/url]
思路:
首先用INET1下载一个404错误的网页源码到变量
然后下载一个我们要检测的网页的源码到变量
然后用STRIOMP()函数对这两个字符串进行比较
如果一样返回0 证明网页是不存在的
返回-1证明网页存在;
具体代码如下:
Private Sub Command1_Click()
Dim i As Integer
Dim bux As String, bux08 As String
Dim buy As String
Dim iCOMP As Variant, icomp_ As Variant
bux = Text1.Text
bux08 = Inet1.OpenURL(bux & buxchang08)
buy = Inet1.OpenURL(bux)
Do
iCOMP = Inet1.GetChunk(10240, icString)
DoEvents
bux08 = bux08 & iCOMP
Loop While Len(iCOMP)
Do
icomp_ = Inet1.GetChunk(10240, icString)
DoEvents
buy = buy & icomp_
Loop While Len(icomp_)
'如果buy bux08字符串一样表明页面不存在
i = StrComp(buy, bux08, 1)
If i = 0 Then
MsgBox "网页不存在!"
MsgBox "buy: " & buy
MsgBox "bux08: " & bux08
ElseIf i = -1 Then
MsgBox "网页存在!"
MsgBox "buy: " & buy
MsgBox "bux08: " & bux08
Else
MsgBox "error!"
End If
End Sub
问题:用INET不能下载完整代码....