从 VB 调用非托管 DLL
我在查找 VB.NET 中对非托管 DLL 进行函数调用的语法时遇到了一些麻烦。 有人熟悉这个吗?
我们假设非托管 DLL“Connector.DLL”中有一个函数“Connected”。 我想通过创建一个抽象函数调用来调用这个函数。
我见过一些代码,看起来像
[DllImport("Connector.DLL")]
Public Shared Function Connect(ByVal intPort)
但是这种语法对我不起作用。
I'm having some trouble finding the syntax for making function calls to unmanaged DLLs in VB.NET. Is anyone familiar with this?
Let's just assume there's a function "Connected" in unmanaged DLL "Connector.DLL". I want to call this function by creating an abstract function call to it.
I've seen some code out there that looks something like
[DllImport("Connector.DLL")]
Public Shared Function Connect(ByVal intPort)
But that syntax doesn't work for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试以下代码。
Try the following code.
在 Visual Studio 中,添加对此 Dll 的引用。
在代码中:
编辑每条评论:
尝试以下代码:
In Visual Studio, add a reference to this Dll.
In Code:
EDIT per comment:
Try this code: