LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I call multiple interfaces from a single COM object?

I created a ATL COM object implementing 2 different interfaces. I want to call this object in Labview but I cannot find how to cast (QueryInterface in VC++ or simple assigment operator in VB) my IInterfaceA to IInterfaceB. Any idea?

Thanks
0 Kudos
Message 1 of 4
(2,824 Views)
I'm not familiar with this functionality, but you could always just created a DLL in VC++ and call it from LabVIEW. I'm not sure if that would work, but it's at least an idea.
J.R. Allen
0 Kudos
Message 2 of 4
(2,823 Views)
I found my answer. Quite simple but you have to know it since it is not obvious in NI's documentation (maybe I searched at the wrong place...)

Here is the solution: just drop a "Variant to Data" function box on your diagram. Connect your IInterfaceA reference in the variant sink, connect an IInterfaceB in the type sink and you'll get a IInterfaceB at the data sink. Then, you can work with the same underlying object you created when you dropped your ClassA on your VI but you access it through IInterfaceB instead of IInterfaceA. You can go back just by doing the opposite.

thanks again
0 Kudos
Message 3 of 4
(2,823 Views)
Multiple interfaces to COM objects....

I have the same problem. I tried your solution in LV6.1 and LV crashed. Tried it in LV7 and got an error. Have you got any other tips?

Thanks,

Steve
0 Kudos
Message 4 of 4
(2,823 Views)