LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the ActiveX API to get all control names and values.

I want to write a C# program that can read all control (includes indicators) values from any opened VI without prior knowledge of the control names. I can do this in LabVIEW using the VI server interface by getting the 'Panel' property from the VI reference and then a list of Controls[] from the panel, recursing as required for clusters, tabs and pages. But I can't see a way to do it with the .NET activeX LabVIEW API, because there doesn't seem to be a way to get a 'Panel' or list of Controls. Am i missing something?

 

I am using LabVIEW 2013 but I doubt that makes much difference...

0 Kudos
Message 1 of 7
(3,914 Views)

I have no experience with using the ActiveX interface, but if it doesn't give that information you should consider just writing a VI which takes the VI name and opens a reference to that VI and gets the info and return it and simply call that VI through the API instead of the relevant properties.

 

There's also a VI class method called "Control Values.Get All", but I don't know if that's exposed through the API either.


___________________
Try to take over the world!
0 Kudos
Message 2 of 7
(3,897 Views)

Thanks tst, I have considered that but would like to avoid it if possible because it would make distribution of the complete application to my users trickier and also because getting the necessary date to the VI will not be particularly easy. But yes, it is definitely a fallback.

0 Kudos
Message 3 of 7
(3,893 Views)

@JonP wrote:

...because it would make distribution of the complete application to my users trickier and also because getting the necessary date to the VI will not be particularly easy...


Not sure that either is true. It should probably not affect the distribution (place the utility VI in a non-executing case structure in a VI which will be loaded and this will guarantee it will be included and loaded) and since the VI you're scanning is loaded, you have its name and that's the only thing that the utility VI needs to open a reference to it.


___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(3,882 Views)

I didn't give you a full description of my appllkication. It is a .NET application that does an awful lot more that just this VI interaction. It reads a load of test descriptions from a database and then does things like asking the user what existing VI [s]he would like to run to implement a test. I want to then open the VI, [s]he then fills in the control values as required and I need to read the values of all the controls and save them in a TestStand Step. So I will have a pile of database, GUI and other code written in C# that I would have to distribute together with a VI, or a DLL made from the VI - OK, I can live with that.

 

But I would also have to get all the control data (sorry, I wrote "date" in my last message!) back from the user's VI into the C# so that I can put it into the TestStand step parameters and also into the database. Obviously I could make the utility VI write it to a file or something but it all seems a bit messy - much beter if I can persuade the LabVIEW ActiveX API to do it!

0 Kudos
Message 5 of 7
(3,872 Views)

I thought you can run VIs through the ActiveX API, but maybe I'm misremembering and I'm not sure how exactly it would map outputs back to your method call. In C you would genenrally allocate space and pass a pointer into the function, but I doubt this would work with the ActiveX API. I suppose the other option is to run the VI and then use the Control Value.Get method to read the value of the output after a while.


___________________
Try to take over the world!
Message 6 of 7
(3,865 Views)

Yes you can get the value of an indicator from a VI using the ActiveX API as long as you know the indicator name, so that would work. Kudoed because you at least answered with a workaround even if you didn't answer the original question Smiley Tongue

0 Kudos
Message 7 of 7
(3,815 Views)