How can I invoke a .Net DLL from a LabView 6.1 VI?
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? Tha开发者_StackOverflow社区t 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.
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:
- Open a new VI
- Go to the front panel
- Right-click, Refnum -> "Automation Refnum" (that's the buzzword you are looking for)
- Right-click, Properties -> Select ActiveX Class
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.)
精彩评论