private bool OpenProgram(Program program) { Windows.PROCESS_INFORMATION processInfo = new Windows.PROCESS_INFORMATION(); Windows.STARTUPINFO startupInfo = new Windows.STARTUPINFO { cb = Marshal.SizeOf(typeof(Windows.STARTUPINFO)), dwFlags = Windows.STARTF_USEPOSITION | Windows.STARTF_USESIZE, dwX = program.Bounds.Left, dwY = program.Bounds.Top, dwXSize = program.Bounds.Width, dwYSize = program.Bounds.Height }; if (!Windows.CreateProcess(program.Path, null, IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref startupInfo, out processInfo)) { return(false); } //Wait until process has started its main message loop Windows.WaitForInputIdle(processInfo.hProcess, Windows.INFINITE); //Close process and thread handles Windows.CloseHandle(processInfo.hThread); Windows.CloseHandle(processInfo.hProcess); return(true); }