From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get to the Virtual Instrument layer of a LabVIEW exe using ActiveX

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:

 

Open Virtual Instrument Snippet.png

 

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

0 Kudos
Message 1 of 12
(3,545 Views)
0 Kudos
Message 2 of 12
(3,529 Views)

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.

0 Kudos
Message 3 of 12
(3,516 Views)

@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.

0 Kudos
Message 4 of 12
(3,503 Views)

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?

0 Kudos
Message 5 of 12
(3,495 Views)

It looks like you need to pass the actual VI path not the executable's path.

0 Kudos
Message 6 of 12
(3,454 Views)

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

0 Kudos
Message 7 of 12
(3,425 Views)

Aye, but how do I specify the path to a VI that is embedded inside an EXE file?

0 Kudos
Message 8 of 12
(3,373 Views)

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

0 Kudos
Message 9 of 12
(3,367 Views)

Hi MrSmith,

 

In short, there's no quick answer. But I found some resources on our website that you may find helpful. 

 

Controlling a VI Using Python

 

Calling LabVIEW Applications from Visual Basic Using ActiveX

 

Loading Measurement Studio ActiveX Controls into Visual C++ 6.0

0 Kudos
Message 10 of 12
(3,332 Views)