LaunchExecutableEx

int LaunchExecutableEx (char *fileName, int windowState, int *handle);

Purpose

Performs the same operation as LaunchExecutable with the following extended features:

Note   If you want to wait for the program to exit, use the system 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 string 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 command string launches the Edit program with the file file.dat:

c:\\dos\\edit.com c:\\file.dat

windowState integer Specifies how to show a Windows program.

Linux This parameter is ignored.

The following table shows valid values for windowState.

Value Application window behavior
LE_HIDE Hidden
LE_SHOWNORMAL Shown normally and activated
LE_SHOWMINIMIZED Displayed as an icon and activated
LE_SHOWMAXIMIZED Displayed as a maximized window and activated
LE_SHOWNA Shown normally but not activated
LE_SHOWMINNOACTIVE Shown as an icon but not activated
Output
Name Type Description
handle integer 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 integer Result of the operation.

Code Description
0 Success.
-1 System was out of memory, executable file was corrupt, or relocations were invalid.
-2 A DLL required by the executable cannot be found.
-3 File was not found.
-4 Path was not found.
-6 Attempt was made to dynamically link to a task, or there was a sharing or network-protection error.
-7 Library required separate data segments for each task.
-9 There was insufficient memory to start the application.
-11 Windows version was incorrect.
-12 Executable file was invalid. Either it was not a Windows application or there was an error in the .exe image.
-13 Application was designed for a different operating system.
-14 Application was designed for MS-DOS 4.0.
-15 Type of executable file was unknown.
-16 You made an attempt to load a real-mode application developed for an earlier version of Windows.
-17 You made an attempt to load a second instance of an executable file that contains multiple data segments that were not marked read only.
-19 The operating system returned an unknown error code.
-20 Attempt was made to load a compressed executable file. You must decompress the file before you can load it.
-21 DLL file was invalid. One of the DLLs required to run this application was corrupt.
-22 Application requires Windows 32-bit extensions.