Question

I'm trying to use RFID Contactless Smart Card (T8/D8 Series) for my final project. But i have problem acessing the dcrf32.dll file in my form.

There are 3 things included in RFID Package, (therefore : 12 smartcards, an usb port, and a driver CD)

In the driver CD, there are so many sample project in some programming language, except VB.NET, i tried them one by one, and that's work.

There is a folder named "win32-dll", it have 3 files inside (dcrf32.dll, dcrf32.h, dcrf32.lib). I have to copy them all in every sample program that i want to use. Image

They also have example in VB.6, when i try to run it, no problems at all. It works. (i also put those 3 dcrf files in the %windows%\System32 folder).

But, when i try to build my own project with Visual Studio 2010 and using VB.NET programming language, i have a problem calling the dcrf32.dll file.

I migrate the VB6 source code to VB.NET, it has error when giving parameters to dc_init function. Can anybody help me? Where is my fault?

Here are the links that important to solve my problems : Here

I just need help with my first button, and you don't have to help me with the other button like in VB 6 example program.

I just wanna know how to connect the dcrf32 files, and why in VB.NET it has error but in VB 6 it works properly.

I wonder it.

Was it helpful?

Solution

The problem that you are having is dealing with your Declare Functions and the fact there are changes to the size of integers and longs etc. in VB.Net. Look at this Link and this Code Project Article on using PInvoke.

i.e. An Integer in VB6 is a Short in VB.Net, A Long in VB6 is an Integer in VB.Net. The % in your Declares is a VB6 Integer and will become a short.

Declare Auto Function dc_init Lib "dcrf32.dll" (ByVal port as Short, ByVal baud As Integer) As Integer
Declare Auto Function dc_exit Lib "dcrf32.dll" (ByVal icdev As Integer) As Short
Declare Auto Function dc_request Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal mode as Short, tagtype As Integer) As Short
Declare Auto Function dc_anticoll Lib "dcrf32.dll" (ByVal icdev As Integer, ByVal bcnt as Short, snr As Integer) As Short

...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top