LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

To call extern exe from labwindows application

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.

0 Kudos
Message 1 of 5
(3,353 Views)

you could consider LaunchExecutable () or system ()

0 Kudos
Message 2 of 5
(3,351 Views)

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).

Message 3 of 5
(3,341 Views)

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.

0 Kudos
Message 4 of 5
(3,311 Views)

The link is dead, any example code available?

0 Kudos
Message 5 of 5
(1,923 Views)