我正在用c#编写一个程序,该程序在隐身模式下创建了谷歌浏览器的进程。一切顺利。我想开始这个过程,并在2秒后杀死它(并关闭铬窗口)。c#中的杀死进程无法处理请求,因为进程已退出
String a = textBox1.Text + " --incognito";//Get the link that the user types
process.StartInfo.FileName = @"C:\Program Files (x86)\Google\Chrome\Application\chrome";
process.StartInfo.Arguments =a;
process.Start();
System.Threading.Thread.Sleep(2000);
process.Kill();
它给我一个错误:无法处理请求,因为进程已退出。
和中断点在process.Kill();线。
错误信息中有什么不清楚? – EZI 2015-03-30 21:54:20
@TylerDay我读过它,但我不明白。我的代码应该如何? – Dionisis 2015-03-30 21:56:38
这可能也有帮助http://stackoverflow.com/questions/14132142/using-c-sharp-to-close-google-chrome-incognito-windows-only – 2015-03-30 22:33:30