|
-
May 22nd, 2014, 11:22 AM
#1
Thread Starter
New Member
calling a c dll functions & get reply messages from that dll
Hi all,
I have a dll that communicate with access control hardware which stores all transactions in its memory
unfortunately, all docs are in c# which I note able to manage since I know vb6 only
the main structure (Type as in vb6) has the following:
Public Structure sysReply
' Fields
<FieldOffset(0)> _
Public nsysNumber As Short
<FieldOffset(4)> _
Public nType As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=&H400), FieldOffset(8)> _
Public sBuffer As Char()
End Structur
the sbuffer array is the union of all events
what I understand that there is no union in vb6 but is UDT
so there is many UDT's thats is related to the sbuffer according to the nType in the sysReply structure
my question is how to deal with the above in vb6?
I did the following
Public type sysReply
nsysNumber As integer
nType as integer
sBuffer() As Byte
end type
public sReply as sysReply
there is other structures that is related to the nType
and use copymemory to copy the sysRply to every udt
like:
Dim bytcommstatus As sysReplyCommStatus
CopyMemory ByVal VarPtr(bytcommstatus), ByVal VarPtr(sReply), LenB(bytcommstatus)
With bytcommstatus
debug.print .status
debug.print .error_no
end with
I get get data but I face two problems
- data are not in same order as udt
- application crashes
can someone show me example?
regards
Tags for this Thread
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
|