拿www.baidu.com举例
1.读www.baidu.com取源文件
2判断,源文件里是否有<a href="http://map.baidu.com">地 图</a>,这么一段,
3如果有,截取“地 图”到list1,
4如果没有<a href="http://map.baidu.com">地 图</a>这一段,执行Command3,
这个该怎么写
1.读www.baidu.com取源文件
2判断,源文件里是否有<a href="http://map.baidu.com">地 图</a>,这么一段,
3如果有,截取“地 图”到list1,
4如果没有<a href="http://map.baidu.com">地 图</a>这一段,执行Command3,
这个该怎么写
解决方案 »
- 生成的exe程序 结束会报错 提供代码请高手帮忙
- 急!!!水晶报表的问题,各位大虾救我!!!
- 打印工资条问题?急急
- 大哥们最后20分 请教 如何 自动排列窗体中的控
- 请问怎么使用VB6去访问windows2000上的access数据库
- 请问有什么好的办法可以限制Combo box中可以输入的字符串长度
- ????datagrid中鼠标单击某一单元格,怎样获得该单元格的内容????
- 高分求救!能不能给我一个setup factory 6。03的注册码?
- 请问怎么触发另一个窗口中控件的事件?
- VB开发MDI应用程序,如何实现PB的popup窗体类型的效果??
- 关于提取网页源文件的另类问题
- 如何导出DMB的数据到TEXTBOX?
DoEvents
If WebBrowser1.Busy = True Then
Else Dim htmhref As New HTMLAnchorElement
Dim htmldoc As New HTMLDocument
Dim htmlEle As New HTMLDTElement
Dim htmlEles As IHTMLElementCollection
Dim nlen As Long
Set htmldoc = WebBrowser1.Document
Set htmlEles = htmldoc.All
nlen = htmlEles.length
Dim i As Long
Dim j As Long
j = 0
For i = 0 To nlen - 1
Set htmlEle = htmlEles.Item(i)
If (htmlEle.tagName = "A") Then
Set htmhref = htmlEle
aaa = "http://map.baidu.com"
If InStr(1, htmhref.href, aaa) <> 0 Then
Ret = SendMessageFind(List1.hwnd, LB_FINDSTRING, 0, (htmhref.href))
If Ret = LB_ERR Then
List1.AddItem htmhref.href
If List1.ListCount >= 1000 Then Exit Do
Me.Caption = List1.ListCount
End If
End If
End If
Next i
End If
Loop
'入口参数为url,返回值为网页源代码
Private Function getHtmlStr$(strUrl$)
Dim XmlHttp As Object
Set XmlHttp = CreateObject("Microsoft.XMLHTTP")
XmlHttp.Open "GET", strUrl, False
XmlHttp.send
getHtmlStr = StrConv(XmlHttp.ResponseBody, vbUnicode)
Set XmlHttp = Nothing
End Function