Ejemplo n.º 1
0
 private static extern bool UnmanagedCreateProcess(string lpApplicationName,
     string lpCommandLine, IntPtr lpProcessAttributes,
     IntPtr lpThreadAttributes,
     bool bInheritHandles, ProcessCreationFlags dwCreationFlags,
     IntPtr lpEnvironment, string lpCurrentDirectory,
     ref ProcessStartupInfo lpStartupInfo,
     out ProcessInformation lpProcessInformation);
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new process and its primary thread.
 /// </summary>
 /// <param name="commandLine"></param>
 /// <param name="creationFlags"></param>
 /// <param name="currentDirectory"></param>
 /// <param name="startupInfo"></param>
 /// <param name="processInformation"></param>
 /// <exception cref="Win32Exception"></exception>
 public static void CreateProcess(string commandLine, ProcessCreationFlags creationFlags,
     string currentDirectory, ref ProcessStartupInfo startupInfo, out ProcessInformation processInformation)
 {
     if (!UnmanagedCreateProcess(null, commandLine, IntPtr.Zero, IntPtr.Zero, false, creationFlags, IntPtr.Zero, currentDirectory, ref startupInfo, out processInformation))
     {
         throw new Win32Exception();
     }
 }