You start a process by calling DosExecPgm. The process you start is a child of the calling, or parent, process and inherits many of the resources owned by the parent process, such as file handles.
DosExecPgm creates a process environment from an executable file. The target program is loaded into storage, and it begins execution.
The following code fragment starts an application named ABC:
#define INCL_DOSPROCESS /* Process and thread values */
#include <os2.h>
CHAR szFailName[CCHMAXPATH];
RESULTCODES resc;
DosExecPgm(szFailName, /* Object-name buffer */
sizeof(szFailName), /* Length of buffer */
EXEC_SYNC, /* Sync flag */
(PSZ) NULL, /* Argument string */
(PSZ) NULL, /* Environment string */
&resc, /* Address for result */
"ABC.EXE"); /* Name of application */
In this example, ABC runs synchronously (as specified by EXEC_SYNC). This means the parent process temporarily stops while the child process runs. The parent process does not continue until the child process ends.