This call places the current thread in a wait state until an asynchronous child process ends. When the process ends, its process ID and termination code are returned to the caller.
DosCwait
ActionCode (USHORT) - input
Value
Value
codeTerminate (USHORT)
Value
Value
DosCwait waits for completion of a child process, whose execution is asynchronous to that of its parent process. The child process is created by a DosExecPgm request with ExecFlags=2 specified. If the child process has multiple threads, the result code returned by DosCwait is the one passed to it by the DosExit request that terminates the process.
DosCwait can also wait for the descendant processes of a child process to complete before it returns. However, it does not report status for descendant processes.
To wait for all child processes and descendant processes to end, issue DosCwait repeatedly, with ActionCode=1 andProcessID=0 specified, until ERROR_NO_CHILD_PROCESS is returned. The contents of ProcessIDWord can be examined to determine which child the termination codes are from.
If no child processes were started, DosCwait returns with an error. If no child processes terminate, DosCwait can wait until one terminates before returning to the parent, or it can return immediately if it specifies WaitOption=1. This parameter is used to return the result code of a child process that has already ended.