04-24-2015 11:57 AM
I have been trying to figure this out for a couple of days, and can't seem to find the correct way to do this. I have a LabVIEW .exe file that was built with ActiveX enabled in the build configuration. I can connect to the application layer just fine (see the snippet below), but I want to get to the front panel controls so I can read/modify their values from another program. To determine how to implement this I made the following test VI:
The problem is that I can't get a VI reference from the .exe file. It appears the GetVIReference method only works on VI's, so if that is the case, how do you get a reference to the top level VI that is running when the .exe starts? I assume it is possible or there would not be a good reason to enable the ActiveX server in the build configuration of the exe file. I eventualy want to get to this from C++ or something similar, but I want to make sure it is even possible before I start trying to determine how to do it in other platforms. Can someone point me to an example of the proper way to do this?
Kind regards,
Jim Smith
04-24-2015 01:26 PM
Have you read http://www.ni.com/tutorial/5719/en/ ?
04-24-2015 03:39 PM
I read this, but I still don't understand. I assume I would interact with a LabVIEW ActiveX enabled application exactly the same way as I would any other ActiveX app, by creating an automation reference, then invoking methods on the ActiveX objects. You just need to know the name of the method. Problem is, the methods I am looking for are GetControlValue and SetControlValue and the only way I can get to those methods is via a VI Reference, which I can't seem to get. Please pardon my denseness, but I don't normally use ActiveX. I'm just trying to expose the top level VI of the application to an associate that needs to manipulate it programmatically using his test program.
04-24-2015 04:40 PM
@MrSmith wrote:
I read this, but I still don't understand. I assume I would interact with a LabVIEW ActiveX enabled application exactly the same way as I would any other ActiveX app, by creating an automation reference, then invoking methods on the ActiveX objects. You just need to know the name of the method. Problem is, the methods I am looking for are GetControlValue and SetControlValue and the only way I can get to those methods is via a VI Reference, which I can't seem to get. Please pardon my denseness, but I don't normally use ActiveX. I'm just trying to expose the top level VI of the application to an associate that needs to manipulate it programmatically using his test program.
I have never done this before, so I am unable to provide further details.
04-24-2015 04:54 PM
No worries, and thanks for the link since there is a lot of good information there. Does anyone else have an example of how to do this?
04-25-2015 05:32 PM
It looks like you need to pass the actual VI path not the executable's path.
04-26-2015 02:57 PM
Y'know, I was kind of unaware you could do this (i.e. have another routine "link into" a LabVIEW executable). However, I have had two LabVIEW executables "talk to each other" and exchange data, using Network Streams to set up Queued Message Handlers in both executables and use Messages to pass data and program control information back and forth.
With whom are you trying to communicate? I'm assuming that because you are using ActiveX, you are not "talking" to another LabVIEW Executable.
Bob Schor
04-27-2015 10:42 AM
Aye, but how do I specify the path to a VI that is embedded inside an EXE file?
04-27-2015 10:54 AM
Hi Bob,
I'll explain a bit more what I am trying to do. I have a LabVIEW executable that was created by a contractor. The .exe file was built using a LabVIEW project with ActiveX enabled. One of the people in my test engineering group wants to be able to programatically start the application and control multiple instances of it through the the front panel using ActiveX from a different platform (Probably C++, Visual Basic, Python or something similar, I am not sure.) The multiple instances part is easy since I can assign a unique VI Server port to each instance via the application configuration file. The part I don't know is how to get to the front panel controls to read and write values programatically. I decided to write a test application in LabVIEW to determine how the ActiveX access to the front panel works, and while I can get to the application layer which allows me to start and stop the application, I can't seem to find a way to get to the Virtual Instrument layer where the functions exist to get and set the front panel controls. Does that make sense?
Kind regards,
Jim Smith
04-28-2015 04:30 PM
Hi MrSmith,
In short, there's no quick answer. But I found some resources on our website that you may find helpful.
Calling LabVIEW Applications from Visual Basic Using ActiveX
Loading Measurement Studio ActiveX Controls into Visual C++ 6.0