01-29-2024 07:23 PM
Is there any way to run SystemExec and get it to output the PID of the created CLI? I don't think there's a way built into LabVIEW, so any other CLI code that could do this reliably would be helpful. I tried to start the exe with a unique window title, but it always seemed to just default back to "GDI+ Window(test.exe)" or "theAwtToolkitWindow", whatever those mean. Any help in understanding these and getting the PID back would be greatly appreciated, thanks!
01-30-2024 12:03 AM
As a little help with understanding - this is what happened when app (powershell in this example) called from LabVIEW and how process tree looks like:
So, the Parent for powershell.exe is not the cmd console, but LabVIEW.exe. And the window which is appeared is conhost.exe, is the Windows Console Host.
May be it is better and easier to get PID from inside of application which you calling from LabVIEW.
01-30-2024 06:44 AM
The OpenG Pipe library has this functionality. I never released it as a package but it is downloadable from here: https://forums.ni.com/t5/LabVIEW/Controlling-the-STDIN-STDOUT-of-a-legacy-application-in-LabVIEW/m-p...
The source code is here if you are inclined to dig into C programming: https://sourceforge.net/p/opengtoolkit/svn/HEAD/tree/trunk/lvpipe/
01-30-2024 08:46 AM