|
-
February 26th, 2010, 09:45 AM
#1
Binary data to a user defined type
Hello,
I have a problem with converting binary data to a user defined type in vb6.0
I have tried to use the RtlMoveMemory function:
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
this way:
CopyMemory ByVal VarPtr(TransTabType), ByVal VarPtr(rs.Fields("NET_MSG")), Len(rs.Fields("NET_MSG")
where TransTabType is a user-defined type:
Private Type TransTab
in_out As Integer
node_id As Integer
group_id As Integer
vogn_id As Integer
koding As Integer
retry As Integer
seq_no(0 To 9) As Byte
trans_type As Integer
error_no As Integer
status_ok As Integer
count_send_no As Integer
channel_no As Integer
base_id As Integer
lengtext As Integer
last_send_time As Long
info_text() As Byte
End Type
And rs.Fields("NET_MSG") is binary data recived from a database.
When I try to run this, the user defined type just got rubbish data.
If the data was in a binary file I could hav used GET function, but in my case
I receive it from a sql database.
Anyone have any ideès, so please help me..?
Best Regards
Paal Fredrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|