Inet1的GetChunk获取的字串长度不够
Function Utf8ToUnicode(ByRef Utf() As Byte) As String
Dim lRet As Long
Dim lLength As Long
Dim lBufferSize As Long
lLength = UBound(Utf) - LBound(Utf) + 1
If lLength <= 0 Then Exit Function
lBufferSize = lLength * 2
Utf8ToUnicode = String$(lBufferSize, Chr(0))
lRet = MultiByteToWideChar(CP_UTF8, 0, VarPtr(Utf(0)), lLength, StrPtr(Utf8ToUnicode), lBufferSize)
If lRet <> 0 Then
Utf8ToUnicode = Left(Utf8ToUnicode, lRet)
Else
Utf8ToUnicode = ""
End If
End Function
'Private Sub Command1_Click()
Function ip2dq(ip)
Dim strurl As String
Dim postdata As String
Dim htmlcode As String
Dim BinBuff() As Byte
strurl = "http://ip.qq.com/cgi-bin/searchip/"
postdata = "218.22.154.142"
Inet1.Execute strurl, "POST", postdata, "Content-Type:application/x-www-form-urlencoded"
Do While Inet1.StillExecuting = True
DoEvents
Loop
BinBuff = Inet1.GetChunk(0, icByteArray)
htmlcode = Utf8ToUnicode(BinBuff)
Text1.Text = htmlcode
Open App.Path & "\cx.txt" For Output As #1
Write #1, htmlcode
Close #1
ip2dq = htmlcode
End Function
差不多类似这样,以防万一把转unicode的过程也写了出来
问题就是 这个过程大概只能获取40多行html代码,我想把整个页面的html代码弄出来但是显然长度不够
之前是直接icstring获得的字串,也是只有40多行html代码,现在加了这个转编码的过程但是依然没有效果 --------------------编程问答-------------------- 顶下。。。。这个问题。也困惑,BinBuff = Inet1.GetChunk(0, icByteArray)
获取的不完整。 --------------------编程问答-------------------- strinfo = Inet1.GetChunk(1024)
While strinfo <> ""
strz = strz + strinfo
strinfo = Inet1.GetChunk(1024)
Wend
补充:VB , 网络编程