CHAR szClient[7]; /* ASCII form of win handle */ CHAR LoadError[100]; /* Buffer for failure reason */ RESULTCODES ReturnInfo; /* Returned info from call */ PID pidServer; /* Child process id */ APIRET rc; /* Return code */ : : itoa(hWnd, szClient); /* Convert handle to ASCII */ rc = DosExecPgm(LoadError, /* Start child process */ sizeof(LoadError), /* Size of buffer */ EXEC_ASYNCRESULT, /* Execute asynchronously */ szClient, /* Window handle in ASCII */ 0, /* No new environment vars */ &ReturnInfo, /* Returned info address */ "server.exe"); /* Name of program to start */ pidServer = ReturnCodes.termcodepid; <Store pidServer in window words>
This example shows the use of the DosExecPgm() function to start a process from another process within the application.