帮忙分析这段VB代码!!!

来源:百度知道 编辑:UC知道 时间:2024/05/16 11:35:14
以下是一段读取网页内容的代码 天气的!!能帮忙分析一下..最好加上注释!!每行的意思

Private Sub Web_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim info As info
Dim temp As String
temp = Web.Document.documentElement.innerHTML
tempa = Split(temp, "show_weather(" & Chr$(34))
tempb = Split(tempa(1), Chr$(34) & Chr$(44) & " new Array" & Chr$(40) & Chr(39))
info.city = tempb(0)
tempa = Split(tempb(1), Chr(39) & Chr$(44) & Chr(39))
temptem = Split(tempa(0), "~")
info.teml = temptem(0)
info.temh = temptem(1)
info.morning = tempa(1)
info.noon = tempa(2)
info.evening = tempa(3)
'==================以上为信息的提取==============================
city.Caption = info.city
lowt.Caption = info.teml
hight.Caption = info.temh
mow.Caption = info.morning
now.Caption = info.noon
evw.Caption = info.evening
End Sub

Private Sub Web_DocumentComplete(ByVal pDisp As Object, URL As Variant) '定义方法
Dim info As info ’定义变量
Dim temp As String ’定义变量
temp = Web.Document.documentElement.innerHTML ’得到对象
tempa = Split(temp, "show_weather(" & Chr$(34)) ’这个是读天气到数组
tempb = Split(tempa(1), Chr$(34) & Chr$(44) & " new Array" & Chr$(40) & Chr(39)) ’同上
info.city = tempb(0) ’
tempa = Split(tempb(1), Chr(39) & Chr$(44) & Chr(39))
temptem = Split(tempa(0), "~")
info.teml = temptem(0)
info.temh = temptem(1)
info.morning = tempa(1)
info.noon = tempa(2)
info.evening = tempa(3)
'==================以上为信息的提取,具体是什么是什么信息要看全部文档================下面不过就是赋值 ==============
city.Caption = info.city
lowt.Caption = info.teml
hight.Caption = info.temh
mow.Caption = info.morning
now.Caption = info.noon
evw.Caption = info.evening
End Sub

info 应该是一个自定义类型。

public type info