Virtual Pascal for OS/2 v1.00 (C) 1996 fPrint UK Ltd London, 7 April 1996 The Os2Exec unit ~~~~~~~~~~~~~~~~ The Os2Exec unit implements a VP/2 class, TRedirExec, which allows your programs to capture the output of a child process which outputs text to standard output. To demonstrate the use of the class, an example program TRedirExec has been included. It creates a TRedirExec instance, and executes a DIR command (through the CMD.EXE command processor) 5 times, and displays the output in a window on the screen by using the Window procedure of the Crt window. TRedirExec ~~~~~~~~~~ The TRedirExec class implements the following published fields, which can be used by application programs. constructor create Must be called to create instance destructor Destroy Must be called to free instance function Execute Is called to execute a child process. Returns True, if the process was executed succesfully, and False otherwise. property Terminated Returns True, if the executing process has terminated and no further lines of output are available. property MessageReady Returns True, if a line of output from the child process is ready. property ReturnCode When Terminated returns True, this property contains the return code of the process. property Message Returns any available output string from the child process, or a blank line if no message is ready. property OnTerminate This method is called when the process terminates property OnCharReady This method is called every time a character is received from the child process. Can be used to perform any pre-processing required. property OnLineReady This method is called every time a line is received. Do note, that the methods are called only when the main program checks the state of MessageReady or Message.