LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX - Get Reference to Control

Solved!
Go to solution

Hello Everyone,

 

I need to trigger a value change event in a VI using LabVIEW's ActiveX interface. 

 

In order to accomplish this I believe I need to obtain the reference to the control and then use the Value (signaling) property of that control.  Does anyone have any insight on how I might obtain the reference to a control via the ActiveX interface?

 

Any other suggestions on how I can trigger a value change event programmatically are certainly welcome.  I have tried the "SetControlValue" invoke function but that doesn't trigger value changes.

 

  Thanks,

  Zach

0 Kudos
Message 1 of 8
(4,846 Views)
Solution
Accepted by topic author zach_listen
I'm not sure if I understood you correctly, but it sounds like you're trying to control LabVIEW via its ActiveX interface from another program, like C. In order to get the reference to a control so you can access the Value (signaling) property you first need to access the VI's Front Panel reference, and then get the list of Controls (which is an array of references). You can walk through this array until you find the one you want and then set the Value (signaling) property.
0 Kudos
Message 2 of 8
(4,831 Views)

Thanks for the response.

 

I neglected to mention that I am calling into an executable.  The VI that I am interested in is located within the .exe.  Your are right though.  I need to get the reference to that VI (the VI server reference, not the ActiveX reference).  Once I have that I should be all set.  Do you know how I can obtain the reference?

 

BTW, I'm using LV 8.6.1.

 

   Thanks,  

   Zach

0 Kudos
Message 3 of 8
(4,825 Views)
Well, you have to enable the ActiveX interface for the EXE. Without that you're not going anywhere. Once you've done that you use ActiveX in whatever programming language you're using to create the "LabVIEW.Application" object. This object has a method to create a reference to a VI. For example, here's an example for VB: Calling a LabVIEW VI from Visual Basic through ActiveX.
0 Kudos
Message 4 of 8
(4,818 Views)

Thanks again for the reply.

 

The problem that I am having isn't utilizing the ActiveX interface.  Rather it is that the "GetVIReference" ActiveX call returns a reference to a data type "VirtualInstrument".  I doesn't return a reference to the VI that can be used in VI Server.  For instance, through the VirtualInstrument reference I am not able to see properties such as "Value (signaling)".  Instead I see properties like:

 

 asdf.JPG

 

What I really need is a reference that I can use via VI Server.

 

Thanks,

Zach

0 Kudos
Message 5 of 8
(4,812 Views)

Hmmm... hadn't realized that the front panel is not exposed in the ActiveX interface. Given that, it seems you won't be able to get a reference to a specific control via ActiveX.

 

You could cheat. You could create a VI that does precisely what you want to do: get a reference to the control using the VI Server and set the Value (signaling) property. Include the VI in your exe and you can call it using the ActiveX interface. As a VI within the exe it will be able to access the VI that contains the control you want to set, and be able to get a reference to it. All that you would need to do is pass the value to this "cheat" VI via the SetControlValue method that is exposed via ActiveX.

Message 6 of 8
(4,805 Views)

Good idea! That did the trick.  Thanks.

 

   -Zach

0 Kudos
Message 7 of 8
(4,791 Views)

Hi,

I am having the same problem. What solution did you come up with? I am fairly new to LabView, can you share a sample VI that uses the cheating method mentioned above?

 

Cheers

 

0 Kudos
Message 8 of 8
(4,013 Views)