private void AttachOutputRedirection(PROCESS_INFORMATION processInformation)
        {
            Process process = Process.GetProcessById((int)processInformation.dwProcessId);

            process.OutputDataReceived += new DataReceivedEventHandler(OutputDataReceived);
            process.ErrorDataReceived += new DataReceivedEventHandler(ErrorDataReceived);

            process.BeginOutputReadLine();
            process.BeginErrorReadLine();
        }
Ejemplo n.º 2
0
 static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes,
                                 IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags,
                                 IntPtr lpEnvironment, string lpCurrentDirectory, ref STARTUPINFO lpStartupInfo,
                                 out PROCESS_INFORMATION lpProcessInformation);
Ejemplo n.º 3
0
 public static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes,
                                         bool bInheritHandles, ProcessCreationFlags dwCreationFlags, IntPtr lpEnvironment,
                                         string lpCurrentDirectory, ref STARTUPINFO lpStartupInfo, out PROCESS_INFORMATION lpProcessInformation);