VB6.0怎么把16BIT数据转为ASCII码
VB6.0怎样把16BIT数据转为ASCII码各位前辈请教一下VB6中怎样把16Bit数据转为ASCII码?如下图所示D12500个16
VB6.0怎样把16BIT数据转为ASCII码 各位前辈请教一下VB6中怎样把16Bit数据转为ASCII码?如下图所示 D12500个16Bit数据,值为16717 上图为转为ASCII码,值变为MA 请教给位大哥怎样用VB6.0写出来啊??[最优解释]
引用: 引用: Dim a(0 To 5) As Byte a(0) = &H71 a(1) = &H4D a(2) = &H32 a(3) = &H42 a(4) = &H39 a(5) = &H45 Debug.Print StrConv(a, vb…… 就是一开始不知道这些值是多少,都是从D12500这个地址取得的值,此值时刻都是在变的 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Sub Command1_Click() Dim Bin As Integer, tmp(0 To 1) As Byte, s As String Bin = 16717 CopyMemory tmp(0), Bin, 2 s = StrConv(tmp, vbUnicode) Debug.Print s End Sub[其他解释] HEX()函数
[其他解释] 16717是十进制数据,对应的16进制就是:414D, 41对应的字符是:A,4D对应的字符是:AM
[其他解释] 16717 = &H41,&H4D = 'AM'
12866 = &H32,&H42 = '2B'
14645 = &H39,&H35 = '95'
?Debug.Print Chr(&H41)
A
?Debug.Print Chr(&H4D)
M
......
[其他解释] 引用: 16717 = &H41,&H4D = 'AM' 12866 = &H32,&H42 = '2B' 14645 = &H39,&H35 = '95' ?Debug.Print Chr(&H41) A ?Debug.Print Chr(&H4D) M ...... 能否不分开让414D直接转为MA??
[其他解释] 把数据放在一个byte类型数组
把数组用strconv转换为unicode字符串
显示字符串
[其他解释] Dim a(0 To 5) As Byte a(0) = &H71 a(1) = &H4D a(2) = &H32 a(3) = &H42 a(4) = &H39 a(5) = &H45 Debug.Print StrConv(a, vbUnicode) [其他解释] 引用: Dim a(0 To 5) As Byte a(0) = &H71 a(1) = &H4D a(2) = &H32 a(3) = &H42 a(4) = &H39 a(5) = &H45 Debug.Print StrConv(a, vbUnicode) 就是一开始不知道这些值是多少,都是从D12500这个地址取得的值,此值时刻都是在变的
[其他解释] 在各位的帮助下解决了,非常感谢