我正在用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