private static void CreateProcess( string lpApplicationName, string lpCommandLine, bool bInheritHandles, uint dwCreationFlags, ref Syscalls.STARTUPINFO lpStartupInfo, out Syscalls.PROCESS_INFORMATION lpProcessInformation) { int retval; retval = Syscalls._CreateProcess( lpApplicationName, lpCommandLine, new IntPtr(0), new IntPtr(0), bInheritHandles, dwCreationFlags, new IntPtr(0), null, ref lpStartupInfo, out lpProcessInformation); if (retval == 0) { int errcode = Marshal.GetLastWin32Error(); throw new Exception("Cannot create process (" + errcode + ": " + Syscalls.GetLastErrorStringMessage() + ")"); } }
public void Start() { ProcessDelegate proc = new ProcessDelegate(DoStart); m_processInfo = new Syscalls.PROCESS_INFORMATION(); CreateProcess(null, CommandLine, InheritHandles, CreationFlags, ref m_startupInfo, out m_processInfo); m_running = true; proc.BeginInvoke(null, null); }