2011-11-25 34 views
0

我試圖運行explorer.exe使用Process.start(ProcessInfo);函數,然後等待進程自行終止,然後在進程退出時執行一些操作。 這裏是代碼snippestProcess.start啓動資源管理器,但瀏覽器仍在運行時將其hasexited屬性設置爲true

ProcessStartInfo StartInfo = new ProcessStartInfo(); 
StartInfo.FileName = "\\SDMMC\\explorer.exe"; 
StartInfo.UseShellExecute = false; 
StartInfo.Arguments = null; 
Process NewProcess = Process.Start(StartInfo); 
NewProcess.WaitForExit(); 
NewProcess.EnableRaisingEvents = true; 
NewProcess.Exited += new EventHandler(NewProcess_Exited); 
MessageBox.Show("ExitCode finished"); 

但explorer.exe的仍在運行和在另一方面NewProcess.HasExited是真實的, 請幫助我如何可以使程序等待Explorer.exe的終止,然後perfom任何行動。 謝謝

回答

0

通常explorer.exe不會退出。另外,如果資源管理器正在運行,試圖啓動另一個實例只會啓動一個Windows資源管理器窗口。從你的代碼片段看起來你正在啓動一個自定義瀏覽器。我已經定製了Windows CE提供的HPC瀏覽器,並且我沒有成功讓它正常退出。我需要更多關於你想要完成的任何其他建議的細節。

相關問題