Inet1的GetChunk获取的字串长度不够

水吧码农 2012-06-02 02:19:58


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代码,现在加了这个转编码的过程但是依然没有效果
...全文
302 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jesoftqq 2013-05-27
  • 打赏
  • 举报
回复
strinfo = Inet1.GetChunk(1024) While strinfo <> "" strz = strz + strinfo strinfo = Inet1.GetChunk(1024) Wend
meng13145421 2013-04-17
  • 打赏
  • 举报
回复
顶下。。。。这个问题。也困惑,BinBuff = Inet1.GetChunk(0, icByteArray) 获取的不完整。

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧