| 发表于:2007-03-05 10:10:501楼 得分:100 |
定义一个将字节数组的内容转换成十六进制字符串的函数: function bytearraytohexstring(abuffer as variant) as string dim iloop as long bytearraytohexstring = " " for iloop = lbound(abuffer) to ubound(abuffer) bytearraytohexstring = bytearraytohexstring & right( "0 " & hex(abuffer(iloop)), 2) & " " next iloop bytearraytohexstring = trim(bytearraytohexstring) end function mscomm1需要定义成按字节方式接收数据: dim abuffer() as byte mscomm1.inputmode = cominputmodebinary if mscomm1.inbuffercount > 0 then abuffer = mscomm1.input text4.text = "接收数据: " & bytearraytohexstring(abuffer) end if | | |
|