Dim Label() As Object
Dim clsT() As New Class1
Function getHTTPPage(Url)
Dim Http
Set Http = CreateObject("MSXML2.XMLHTTP")
Http.Open "GET", Url, False
a = Http.send()
If Http.readystate <> 4 Then
Exit Function
End If
getHTTPPage = BytesToBstr(Http.responseBody, "GB2312")
Set Http = Nothing
If Err.Number <> 0 Then Err.Clear
End Function
Function BytesToBstr(body, Cset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function
Private Sub Form_Load()
Dim Url, Html
Url = InputBox("請輸入壹個網址")
a = Split(getHTTPPage(Url), "href=")
Dim i As Integer
Dim nTop As Long
ReDim Label(UBound(a) - 1)
ReDim clsT(UBound(a) - 1)
For i = 1 To UBound(a) - 1
Set Label(i) = Controls.Add("VB.Label", "Label" & CStr(i))
Label(i).Height = 300
Label(i).Top = nTop
Label(i).Visible = True
TEMP = Split(a(i), ">")(0)
If Left(TEMP, 4) <> " Explorer\iexplore.exe " & L.Caption
End Sub