使用 VB.NET 进行 RFID 编程

发布于 2024-12-18 16:39:15 字数 901 浏览 3 评论 0原文

我正在尝试在我的期末项目中使用 RFID 非接触式智能卡(T8/D8 系列)。 但我在访问表单中的 dcrf32.dll 文件时遇到问题。

RFID 包中包含 3 个东西(因此:12 个智能卡、一个 USB 端口和一张驱动程序 CD)

在驱动程序 CD 中,有很多某种编程语言的示例项目,除了 VB.NET,我尝试了其中一个一,这就是工作。

有一个名为“win32-dl​​l”的文件夹,里面有3个文件(dcrf32.dlldcrf32.hdcrf32.lib) 。我必须将它们全部复制到我想要使用的每个示例程序中。 Image

他们也有 VB.6 中的示例,当我尝试运行它时,没有任何问题。有用。 (我还将这 3 个 dcrf 文件放在 %windows%\System32 文件夹中)。

但是,当我尝试使用 Visual Studio 2010 并使用 VB.NET 编程语言构建自己的项目时,我在调用 dcrf32.dll 文件时遇到问题。

我将VB6源代码迁移到VB.NET,向dc_init函数提供参数时出现错误。 有人可以帮助我吗?我的错在哪里?

以下是对解决我的问题很重要的链接: 这里

我只需要第一个按钮的帮助,而你不需要不必像 VB 6 示例程序中那样帮助我使用其他按钮。

我只是想知道如何连接 dcrf32 文件,以及为什么在 VB.NET 中它有错误,但在 VB 6 中它工作正常。

我想知道。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

殤城〤 2024-12-25 16:39:15

您遇到的问题是处理声明函数以及 VB.Net 中整数和长整型等的大小发生变化的事实。查看此链接和此代码项目有关使用 PInvoke 的文章

即VB6中的整数是VB.Net中的Short,VB6中的Long是VB.Net中的整数。声明中的 % 是一个 VB6 整数,将变成一个短值。

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

...

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

...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文