111,120
社区成员
发帖
与我相关
我的任务
分享 private void button4_Click(object sender, EventArgs e)
{
#region 打开外部exe程序
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = textBox3.Text;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.EnableRaisingEvents = true;
myProcess.Start();
#endregion
//myProcess.StandardOutput.ReadToEnd();
//myProcess.BeginOutputReadLine();
myProcess.WaitForExit();
}
这样程序的主界面是关闭不了的,需要等外部程序运行完了,才可以对主界面进行操作,我的意思是在外部程序运行的过程中,能够对主界面进行操作,例如添加一个推出的按钮,按下的时候同时关闭外部程序和程序,但现在的问题是运行到myProcess.WaitForExit();主界面就锁死了,exited这个事件很简单的啊

