注意申明:Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _ lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long) Type taaa a as long b as integer c as byte end type dim a as taaa a.a = ... 'send dim lc as long lc=lenb(a)dim bt() as byte redim bt(lc-1)Copymemory bt(0),a,lcwinsock1.senddata bt 'recieve: dim bt() as byte winsock1.getdata bt dim a as taaa Copymemory a, bt(0), lenb(a)
lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
Type taaa
a as long
b as integer
c as byte
end type
dim a as taaa
a.a = ...
'send
dim lc as long
lc=lenb(a)dim bt() as byte
redim bt(lc-1)Copymemory bt(0),a,lcwinsock1.senddata bt
'recieve:
dim bt() as byte
winsock1.getdata bt
dim a as taaa
Copymemory a, bt(0), lenb(a)