Type AA
AA1 As Integer
AA2 As Integer
End TypeType BB
BB1 As AA
BB2 As String * 20
BB3 As Integer
End TypeFunction S2B(T As BB) As Byte()
Dim A() As Byte
ReDim A(Len(T) - 1)
CopyMemory A(0), T, Len(T)
S2B = A
End FunctionFunction B2S(A() As Byte) As BB
Dim T As BB
CopyMemory T, A(0), Len(T)
B2S = T
End Function'这种情况是完全没有问题的.
'但是我想在以下那种情况中.Type CC
CC1() As Integer
CC2() As Long
End TypeType AA
AA1 As Integer
AA2 As Integer
End TypeType BB
BB1 As AA
BB2 As String * 20
BB3 As Integer
BB4() As AA
BB5() As CC
BB6(1 to 9) As AA
BB7(1 to 20) As CC
End Type'问题出现了,无法解决
'跪求这个问题的解.
'用在发送数据和接收数据的Dim Lem1 As BB
Dim LemB() As Byte
LemB = S2B(Lem1)
SendDate LemB
AA1 As Integer
AA2 As Integer
End TypeType BB
BB1 As AA
BB2 As String * 20
BB3 As Integer
End TypeFunction S2B(T As BB) As Byte()
Dim A() As Byte
ReDim A(Len(T) - 1)
CopyMemory A(0), T, Len(T)
S2B = A
End FunctionFunction B2S(A() As Byte) As BB
Dim T As BB
CopyMemory T, A(0), Len(T)
B2S = T
End Function'这种情况是完全没有问题的.
'但是我想在以下那种情况中.Type CC
CC1() As Integer
CC2() As Long
End TypeType AA
AA1 As Integer
AA2 As Integer
End TypeType BB
BB1 As AA
BB2 As String * 20
BB3 As Integer
BB4() As AA
BB5() As CC
BB6(1 to 9) As AA
BB7(1 to 20) As CC
End Type'问题出现了,无法解决
'跪求这个问题的解.
'用在发送数据和接收数据的Dim Lem1 As BB
Dim LemB() As Byte
LemB = S2B(Lem1)
SendDate LemB
解决方案 »
- 北京市朝阳区广顺北大街33号院1号楼福码大厦B座12层
- 续:自定义报表的大小以避免报表宽度大于纸的宽度
- 数据库操作API函数的意思
- 关于textbox的问题--在其中输入文字时如何让问题靠右显示
- 怎样用数据库联接图片?高手看一看
- 请教:工程组之间的各个工程怎样启动!
- 4张盘的vb.net和7张盘的vb.net有什么不一样?
- 怎样用VB中PICTURE的图形保存一个图片文件(文件大小要很小的,越小越好)
- 请问在VB里怎么用printer对象设置打印纸的大小??
- 问一问大家,怎么样才能赚取CSDN里面的可用分,我现在的可用分只有0分了。
- Textbox里面的数据如果改变?
- 模仿WIN 7“轻松访问”里的“鼠标标记”功能问题
get #1,,lemb
SendDate LemB'如果用生保存为文件再用数组读取就可以,但是应该还有我不了解的其它方法
而 CopyMemory 是纯内存操作,不管数据的类型。如果不想自己做序列化/反序列化,读写文件也是一种可行的方案。