11-03-2010 09:44 AM
Hi,
I have programmed a application in Labwindows C. This application should start a executable file (exe) which is included anywhere else in a folder (e.g.: c:\\MyFolder\\Appl\\Trimming.exe) . I`d like to push a button in the labwindows application for starting this extern exe as modal window.
I don`t know a valid command to start this extern exe after pushing button.
Can anybody help
Thx.
11-03-2010 09:54 AM
you could consider LaunchExecutable () or system ()
11-03-2010 11:01 AM - edited 11-03-2010 11:03 AM
Cassiopeia:
As Wolfgang already mentioned, there are multiple ways to launch an executable from CVI.
system() will wait for the program to exit. LaunchExecutable() does not wait. Since you mentioned wanting the exe to be in a modal window, system() might be the easiest for you since it will wait for the exe to exit before continuing with the CVI code. You can view the online help for those functions or search this forum for many discussions on them.
If you need to get a return value from the executable, you can use Windows API functions to launch the executable using CreateProcess(), and then use GetExitCodeProcess() to read the results.
See more details here: http://digital.ni.com/public.nsf/allkb/E250246D65A6A18D8625659F0065F310
Note that you need to have the Windows SDK (aka Win32 API) installed to use CreateProcess/GetExitCodeProcess. The SDK is included with CVI, but is not installed by default. If you don't have it installed, reinstall CVI, selecting only SDK or Win32API (depending on which version of CVI you have).
11-04-2010 02:11 AM
Many thx for this information. I have tried it out and it works fine. It was just the isue I searched for. THANKS A LOT FOR YOUR KINDLY HELP.
07-03-2019 10:28 AM
The link is dead, any example code available?