VB里将自定义type类型序列化,及反序列化.

VB里将自定义type类型序列化,及反序列化.
可用语网络传输的数据协议上:
Option   Explicit
Private  Declare  Sub  CopyMemory Lib  " kernel32 "  Alias  " RtlMoveMemory "  (Destination  As  Any, Source  As  Any, ByVal Length  As   Long )

Private  Type xx
     intX 
As   Integer
     intY 
As   Integer
End  Type
Dim  zz  As  xx
Dim  a( 3 As   Byte
Private   Sub  Command1_Click()
 
Dim  i  As   Integer
 
Call  CopyMemory(a( 0 ), zz,  4 )
 
 
For  i  =   0   To   3
  Debug.Print a(i)
 
Next
 
' //initial data
 zz.intX  =   0
 zz.intY 
=   0
 
Call  CopyMemory(zz, a( 0 ),  4 )
 Debug.Print zz.intX
 Debug.Print zz.intY
End Sub

Private   Sub  Form_Load()
  zz.intX 
=   600
  zz.intY 
=   800
End Sub

你可能感兴趣的:(反序列化)