Jump to content

Marshalling COM interfaces through ActiveX Server


Recommended Posts

I have used LabVIEW to build a standalone exe that is an ActiveX Server. I have no problem connecting to this server (either with another LabVIEW vi or with Visual Basic) and I have no problem getting and setting the values of controls on the front panel, with the exception of the control I'm most interested in, which is an ActiveX refnum indicator.

When I call "GetControlValue" using the name of the ActiveX refnum indicator and it is empty, then I correctly get an empty refnum returned.

When the indicator holds an actual COM object refnum, then the GetControlValue invoke node returns error -2147418113 (aka 0x8000FFFF, which is the generic COM error E_UNEXPECTED).

My question is - can I expect LabVIEW to marshall third-party COM dispatch interfaces through its ActiveX Server methods? And if so, what do I need to do to make it happen?

Link to comment
My question is - can I expect LabVIEW to marshall third-party COM dispatch interfaces through its ActiveX Server methods? And if so, what do I need to do to make it happen?

I don't think LabVIEW in itself supports marshalling of arbitrary COM interfaces through its ActiveX interface. That would be a whole bunch of extra code to make it generic enough to support all possible datatypes.

Rolf Kalbermatter

Link to comment
I don't think LabVIEW in itself supports marshalling of arbitrary COM interfaces through its ActiveX interface. That would be a whole bunch of extra code to make it generic enough to support all possible datatypes.

I'm not asking for marshalling arbitrary interfaces - all that LabVIEW would have to do is to marshall a generic IDispatch pointer. Once the client process has the IDispatch pointer, then the third-party application is responsible for all handling the QueryInterface calls and stuff. I can do the equivalent marshalling of a generic interface in C++ in about three lines of code (Line 1: AddRef, Line 2: cast to LPDISPATCH, Line 3: return to caller).

I'm definitely a LabVIEW newbie, but I'm a COM old hat, so I know exactly what needs to be done, just not how to do it.

[edited] I should also add that when I try to do the same thing locally through VI Server (i.e., have a client VI fetch an arbitrary COM interface from a Refnum indicator in another VI in the same process with the Ctrl Val.Get command), it works just fine. But I can't get the equivalent functionality to work across processes through the ActiveX Server.

Link to comment
[edited] I should also add that when I try to do the same thing locally through VI Server (i.e., have a client VI fetch an arbitrary COM interface from a Refnum indicator in another VI in the same process with the Ctrl Val.Get command), it works just fine. But I can't get the equivalent functionality to work across processes through the ActiveX Server.

You misunderstand VI server a bit here. VI server is the actual core functionality directly operating on the LabVIEW object hierarchy. LabVIEW objects have absolutely nothing to do with COM at all. LabVIEW to LabVIEW communication on VI server level happens through a LabVIEW private TCP/IP protocol and should support the same features except the ones that are limited on purpose for security reasons.

The LabVIEW ActiveX server interface is just a wrapper around the VI server interface and I'm sure some of the COM concepts map better to the VI server object model than others.

But considering your NI icon I would say you should definitely contact Lucyangeek aka Brian Tyler who is very proficient with .Net and ActiveX functionality and how it is implemented and used in LabVIEW.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.