0

Dear friends,

I wrap an unmanaged VC++ 6.0 class in VB .NET like below :

Declare Function ACR120_ReadATQB Lib "ACR120U.DLL" (ByVal rHandle As Short, ByRef pATQB As Byte) As Short
    Declare Function PICC_RATS Lib "ACR120U.DLL" (ByVal rHandle As Short, ByVal FSDI As Byte, ByRef atslen As Byte, ByRef ats As Byte) As Short

but when i start coding , i encounter the following difficulties,

how to conver this VC++ code into VB .NET ..

CardFrameSize = pResponseData(1) & 0x0f

does anybody know how to declare this

pResponseData(1) & 0x0f

in VB .NET ?


complete code
==================

1.
i change pResponseData in C++ becoming pResponseData(0), is this true ?
 
C++
..
BYTE	DataLength, pData[10], ResponseDataLength, pResponseData[100];
INT16	TimeOut=50, i, CardFrameSize;
char	pdata[500];
char	*ATS_ATQB;

if (ACR120_ReadATQB(rHandle, pResponseData)==0) {
ResponseDataLength=7;
// if (ACR120_DirectSend(rHandle, 2, pData, &ResponseDataLength, pResponseData, TimeOut)==0) {
CardFrameSize=pResponseData[10]>>4;
}
..
 
VB
..
        Dim DataLength As Byte
        Dim pData(10) As Byte
        Dim ResponseDataLength As Byte
        Dim pResponseData(100) As Byte

If ACR120U.ACR120_ReadATQB(G_rHandle, pResponseData(0)) = 0 Then
ResponseDataLength = 7
CardFrameSize = pResponseData(10) >> 4
End If
..
 
 
2.
i change pResponseData in C++ becoming pResponseData(0), and   &ResponseDataLength (C++) becoming ResponseDataLength(VB), is this true ?
and how to write pResponseData[1]&0x0f;  in VB .NET ??
C++
..
if (PICC_RATS(rHandle, 4, &ResponseDataLength, pResponseData)>=0) {
CardFrameSize=pResponseData[1]&0x0f;
}
..
VB
..
If ACR120U.PICC_RATS(G_rHandle, 4, ResponseDataLength, pResponseData(0)) >= 0 Then
CardFrameSize = pResponseData(1) & 0x0f 
End If
..
 
 
3.
 
And how to write the following statements in VB .NET correctly, i try but they are not right...
 
C++
...
for (i=0; i<ResponseDataLength; i++) {
StrMsg.Format(" %02X", pResponseData[i]);
strcat(pdata,StrMsg);
}
StrMsg.Format("%s = %s", ATS_ATQB, pdata);
LstIndx=m_List.AddString(StrMsg);
...
 
 
my VB .NET code which triggers error : 
..
For i = 0 To ResponseDataLength - 1
pData = pData + pResponseData(i).ToString() + "02X"
Next
ListBox1.Items.Add(ATS_ATQB.ToString + " = " + pData)
..
 
...
 
Thank you,
hendy
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by kerek2
0

How now?....is it correct your coding?...i'm also going on with this ACr120u reader for my proj but still problem...may we discuss on it?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.