-
I am receiving a TCP packet into a byte array. I want to move it into a
user-defined type so that I can access its individual primitives, i.e. long,
strings, etc. I am new to VB and cannot find a way to cast or convert. Any
help is appreciated. Thanks. BarryD
-
Use CopyMemory API.
Code:
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim MyOLDdata As Byte
Dim MyNEWdata As MyUDT
Private Sub Command1_Click()
'Copy MyOLDdata to MyNEWdata
CopyMemory MyNEWdata, MyOLDdata, Len(MyOLDdata)
End Sub