disperl/src/disperl.cxx
///////////////////////////////////////////////////////////////////////
// PrepAndLaunchRedirectedChild
// Sets up STARTUPINFO structure, and launches redirected child.
/////////////////////////////////////////////////////////////////////// 
PrepAndLaunchRedirectedChild
Sets up STARTUPINFO structure, and launches redirected child.
PrepAndLaunchRedirectedChild Sets up STARTUPINFO structure and launches redirected child .
void PrepAndLaunchRedirectedChild(char* szCmd,
									 HANDLE hChildStdOut,
                                     HANDLE hChildStdIn,
                                     HANDLE hChildStdErr,
									 HANDLE hOutputFile
									)
   {
      PROCESS_INFORMATION pi;
      STARTUPINFO si;
      ZeroMemory(&si,sizeof(STARTUPINFO));
      si.cb = sizeof(STARTUPINFO);
      si.wShowWindow = SW_HIDE;
      si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
      si.hStdOutput = hChildStdOut;
      si.hStdInput  = hChildStdIn;
      si.hStdError  = hChildStdErr;
      if (!CreateProcess(NULL,szCmd,NULL,NULL,TRUE,
                         0,NULL,NULL,&si,&pi))
         DisplayError("CreateProcess",hOutputFile);
      hChildProcess = pi.hProcess;
      if (!CloseHandle(pi.hThread)) DisplayError("CloseHandle pi.hThread",hOutputFile);
   }
void PrepAndLaunchRedirectedChild ( char * szCmd , HANDLE hChildStdOut , HANDLE hChildStdIn , HANDLE hChildStdErr , HANDLE hOutputFile ) { PROCESS_INFORMATION pi ; STARTUPINFO si ; ZeroMemory ( & si , sizeof ( STARTUPINFO ) ) ; si . cb = sizeof ( STARTUPINFO ) ; si . wShowWindow = SW_HIDE ; si . dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW ; si . hStdOutput = hChildStdOut ; si . hStdInput = hChildStdIn ; si . hStdError = hChildStdErr ; if ( ! CreateProcess ( NULL , szCmd , NULL , NULL , TRUE , 0 , NULL , NULL , & si , & pi ) ) DisplayError ( " " , hOutputFile ) ; hChildProcess = pi . hProcess ; if ( ! CloseHandle ( pi . hThread ) ) DisplayError ( " " , hOutputFile ) ; }
PrepAndLaunchRedirectedChild
Sets up STARTUPINFO structure, and launches redirected child.
PrepAndLaunchRedirectedChild Sets up STARTUPINFO structure and launches redirected child .
// Set up the start up info struct. // Use this if you want to hide the child: // Note that dwFlags must include STARTF_USESHOWWINDOW if you want to // use the wShowWindow flags. // Launch the process that you want to redirect // Set global child process handle to cause threads to exit. // Close any unnecessary handles.