예제 #1
0
		internal extern static int CreateProcessCE(string pszImageName, string pszCmdLine, IntPtr psaProcess, IntPtr psaThread, int fInheritHandles, int fdwCreate, IntPtr pvEnvironment, IntPtr pszCurDir, IntPtr psiStartInfo, PROCESS_INFORMATION pi);
예제 #2
0
		public static IntPtr CreateProcess(string FileName, string CommandLine)
		{
			PROCESS_INFORMATION pi = new PROCESS_INFORMATION();

			if(CreateProcessCE(FileName, CommandLine, IntPtr.Zero, IntPtr.Zero, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pi) == 0)
			{
				throw new WinAPIException("Cannot Create Process");
			}
			
			return pi.hProcess;
		}