如何从 LabView 6.1 VI 调用 .Net DLL?
我在一家制造公司工作,该公司使用 LabView 来测试我们制造的设备。大多数测试工程师都使用 7.1,它可以本地引用 .Net 程序集。然而,有一个小组停留在 LabView 6.1 上。我希望他们能够使用我的 .Net 程序集,它基本上是某些 Web 服务的代理。
我创建了一个测试程序集,它只不过是 Hello World,并且我正在尝试在 VI 中使用它。我将其设置为 COM 可见,并使用 regasm.exe 注册了它并创建了一个类型库,但我不确定是否需要该类型库。当我打开“添加引用”窗口时,我可以在 Visual Studio 的 COM 对象列表中看到它,因此我知道它已正确注册。
我对VI非常陌生。我之所以关注它,是因为我在制造业中接触过的人都不知道如何在 VI 中调用 COM 对象。我基本上是在寻找一些控件名称或菜单选项,以便为测试工程师指明正确的方向。
我在 Google 和 NI 论坛上进行了大量网络搜索,但没有找到太多内容。
或者,编写一个 C 或 C++ DLL 来充当 .Net DLL 的代理会更容易吗?或者有没有一种简单的方法可以从 VI 调用 Web 服务?这可能完全不需要 DLL。
我目前正在阅读 NI 的这份文档 寻求帮助,但它显然知道与 .Net 无关,可能无法帮助我选择最佳的前进道路。
I work in a manufacturing company that uses LabView for testing the devices we make. Most of the test engineers are using 7.1 which can natively reference a .Net assembly. However, there is a group that is stuck on LabView 6.1. I would like for them to be able to use my .Net assembly which is basically a proxy to some web services.
I have created a test assembly that is nothing more than Hello World, and I'm trying to consume it in a VI. I made it COM visible, and registered it with regasm.exe and created a type library, which I'm not sure I need. I can see it in Visual Studio in the list of COM objects when I open the Add Reference window, so I know it's registered properly.
I'm very unfamiliar with VI's. I'm only looking at it because no one I have spoken to in manufacturing knows anything about invoking a COM object in a VI. I'm basically looking for some names of controls or menu options to get the test engineers pointed in the right direction.
I did a bunch of web searching on Google and the NI forums, but didn't find much.
Alternatively, would it be easier to write a C or C++ DLL that acts as a proxy to my .Net DLL? Or is there a simple way to invoke a web service from a VI? That might obviate the need for a DLL altogether.
I'm currently reading through this document from NI for help, but it obviously knows nothing about .Net and might not be able to help me choose the best path forward.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哇,LabView 6.1!这是一个很棒的版本,但已经有 8 年或更长时间不受支持了。不过,我认为 COM 接口并没有太大变化。
以下是向 LabView VI 添加 COM/ActiveX dll 的方法:
如果您能找到您的 ActiveX 函数,那么您就处于良好状态。 LabView属性节点和调用节点对应于属性和方法。
Web 服务只是一个 http 调用 GET 或 POST,因此它始终有效。不过,您将自己进行解析。 (此外,LV 6.1 没有内置 http GET/POST,因此我过去常常使用 WinHTTP,通过上面的 ActiveX 来执行这些操作。)
Wow, LabView 6.1! A great release, but unsupported for 8 or more years now. I think the COM interface has not changed much, however.
Here's how to add a COM/ActiveX dll to a LabView VI:
If you can find your ActiveX function that way you are in good shape. LabView property nodes and invoke nodes correspond to properties and methods.
A web service is just an http call GET or POST, so that will always work. However you will be on your own doing the parsing. (Also, LV 6.1 does not have http GET/POST built-in, so I used to use WinHTTP,via ActiveX as in the above, to perform those actions.)