Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Call and pass/get data to/from a LabVIEW .exe application/file fom Measurement Studio

Good day!

I have found the example in the VS.NET Development Library on how to control a LabVIEW VI via ActiveX from Visual Studio .NET and it works very nicely. Now I am trying to do the same thing with a LabVIEW .exe file but unfortunately I have been unsuccessful.

Can anyone help me on how to call a LabVIEW .exe file from Visual Studio (c#) and pass some expressions and retreive them, when the .exe ends.


0 Kudos
Message 1 of 4
(3,797 Views)
One idea is simply to call the executable with the arguments using System.Diagnostics.Process.Start(string filename, string arguments).  Then in your LabVIEW program, you would use a property node to get the command line arguments.  For this data, simply use a property node under the application control palette.  Then click on "Property" and select Application -> Command Line arguments.  The string array output of this corresponds to each element of string arguments delimited by spaces (For multi-word arguments, use a quote around the multiple words - remember to use the @ literal sign).
 
If this method does not work for your application, you can always use a pipe, which is simply a file used for communication between multiple programs.  For instance, Application A might write "Hello B" to C:\pipe.txt.  Application B could wait for this phrase and write "Hello A" to C:\pipe.txt, and so on.
 
Thanks,
Andy McRorie
Applications Engineer
National Instruments
 
 
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 4
(3,781 Views)
Thanks for your reply. We were going to use .txt files anyway (it is the simplest solution) but I was really curious if this could be done in another way i.e. like the example I mentioned in the first thread. Also the idea with passing parameters through ShellExecute might proove usefull in another project. I don't know why I haven't come up with that one before.

And remember, it's friday, weekend ahead 🙂
0 Kudos
Message 3 of 4
(3,777 Views)
Unfortunately, once the LabVIEW VI has been turned to an executable, there is not library functions to be able to control it via ActiveX or other protocols. Andy's solution seems to be the best solution for accomplishing the calling and controlling of LabVIEW executables, as it treats these as any other executables.

Brandon Vasquez
Applications Engineer
National Instruments

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 4 of 4
(3,764 Views)