LaunchExecutableEx
- Updated2023-02-21
- 4 minute(s) read
LaunchExecutableEx
int LaunchExecutableEx (char filename[], int windowState, int *handle);
Purpose
Performs the same operation as LaunchExecutable with the following extended features:
- Under Windows, you can specify how the Windows application displays.
- LaunchExecutableEx returns a handle to the executable that can show whether the executable is still running and that you can use to terminate the executable.
![]() |
Note If you want to wait for the program to exit, use the systemsystem function in the ANSI C Library. |
When you launch several processes with LaunchExecutableEx but do not call RetireExecutableHandle on them, you might reach the limit for the maximum number of processes the system imposes. This happens even if the processes terminate; the program does not recognize that the processes have terminated until you call RetireExecutableHandle.
Parameters
Input | ||||||||||||||||
Name | Type | Description | ||||||||||||||
filename | char [] | Pathname of executable file to run. If the program is not in one of the directories specified in the PATH environment variable, you must specify the full path. The path can include arguments to pass to the program. If the program is a .pif, .bat, or .com file, you must include the extension in the pathname. For example, under Windows, the following function call launches the Edit program with the file file.dat: LaunchExecutableEx ("edit.com c:\file.dat"); |
||||||||||||||
windowState | int | Specifies how to show a Windows program. (Linux) This parameter is ignored. The following table shows valid values for windowState.
|
||||||||||||||
Output | ||||||||||||||||
Name | Type | Description | ||||||||||||||
handle | int | Handle that represents the executable launched. You can pass the handle to ExecutableHasTerminated and TerminateExecutable. When you no longer need the handle, call RetireExecutableHandle. If you do not want to obtain a handle, you can pass NULL. |
Return Value
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
result | int | Result of the operation. Error codes vary, depending on whether you have a Windows or Linux application.
|
Additional Information
Library: Utility Library
Include file: utility.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later