我有下面的代碼行:Process.Kill()的問題
Process aProcess = Process.Start("ieexplorer", aDummyHTMLFilePath);
//I do nothing in between
aProcess.Kill();
如果有NO其他IE窗口中打開此運行平穩。
但如果有一個窗口打開,我得到一個aProcess.Kill();
說System.InvalidOperationException
:
無法處理請求,因爲該進程已退出。
此外,我注意到,在這種情況下,aProcess.HasExited
在上面的代碼中緊接着第1行。
即使打開其他IE窗口,我該如何順利關閉IE?
不是IE將URL傳遞給已經運行的實例(如果存在的話),然後退出? – CodeCaster 2012-08-13 08:59:22
@CodeCaster:你說得對。感謝您的評論。 – ViV 2012-08-14 02:04:48