Item "台湾省"
Combo1.AddItem "香港特别行政区"
Combo1.AddItem "澳门特别行政区"
Combo1.ListIndex = 0
End Sub
Private Sub WebBrowser1_DownloadComplete()
Dim i As Long
Dim j As Long
Dim k As Long
Dim intTemp As Integer
On Error Resume Next
If Len(strHTML) = 0 Then
''Get data
strHTML = WebBrowser1.Document.documentElement.innerHTML
If Len(strHTML) <> 0 Then
For j = 0 To 2
i = InStr(strHTML, "<DIV class=City_Data>")
strHTML = Mid$(strHTML, i)
Weatherday(j).strAdd = GetData("<H3>", "</H3>", strHTML)
Weatherday(j).strDate = GetData("<P>", "</P>", strHTML)
Weatherday(j).strPicPath = GetData("src=" & Chr$(34), Chr$(34) & "></DIV>", strHTML)
Weatherday(j).strWeather = GetData("Weather_TP>", "</DIV>", strHTML)
Weatherday(j).strWind = GetData("Weather_W>", "</DIV>", strHTML)
i = InStr(strHTML, "<DIV class=Weather_SM")
strHTML = Mid$(strHTML, i)
intTemp = IIf(j = 0, 9, 5)
For k = 0 To intTemp
Weatherday(j).strSM(k) = GetData("<P>", "</P>", strHTML)
Next
Next
''Display Data
Call DisPlayData(StaFlag)
Label1.Caption = "下载完成 "
End If
End If
Exit Sub
err1:
End Sub
Public Sub DisPlayData(index As Byte)
On Error GoTo ToExit ''打开错误陷阱
''------------------------------------------------
Dim i As Integer
Frame1(0).Caption = Replace$(Weatherday(index).strAdd, " ", " ")
todayTime(0).Caption = Replace$(Weatherday(index).strDate, " ", " ")
TodayTP(0).Caption = Replace$(Weatherday(index).strWeather, " ", " ")
TodayTP(1).Caption = Replace$(Weatherday(index).strWind, " ", "")
For i = 0 To 9
TodayTP(i + 2).Caption = vbNullString
TodayTP(i + 2).Caption = Mid$(Replace$(Weatherday(index).strSM(i), "</SPAN>", ""), 7)
Next
Call DownBinData(Weatherday(index).strPicPath)
DoEvents
Image1.Picture = LoadPicture(App.Path & "\imag.gif")
index = index + 1
If index >= 3 Then index = 0
''------------------------------------------------
Exit Sub
''----------------
ToExit:
End Sub
Public Function GetData(StartFlag As String, EndFlag As String, strSource As String) As String
Dim lngStart As Long
Dim lngEnd As Long
Dim strTemp As String
lngStart = InStr(1, strSource, StartFlag)
lngEnd = InStr(lngStart, strSource, EndFlag)
str
|