回覆列表
  • 1 # ngdzh12347

    vb6,新建一個工程貼上以下程式碼,馬上執行,一切OK!!!!!!Private Sub Form_Load()a = getHTTPPage("http://ip138.com/ip2city.asp")b = Split(a, "[")(1)c = Split(b, "]")(0)MsgBox cEnd SubFunction getHTTPPage(url)On Error Resume Next Dim http Set http = CreateObject("MSXML2.XMLHTTP") http.Open "GET", url, False getHTTPPage = http.Send()"MsgBox http.ReadyState If http.ReadyState 4 Then MsgBox "無法連線伺服器" Exit Function End If getHTTPPage = BytesToBstr(http.responseBody, "GB2312") Set http = NothingEnd FunctionFunction 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 = NothingEnd Function

  • 中秋節和大豐收的關聯?
  • 假如劉備死的比關羽張飛早,關羽和張飛會投靠誰?