我正在使用Visual C#2010(.NET Framework 3.5)創建一個GUI應用程序。如何將此代碼更改爲無停止響應?在for循環中處理WaitForExit時掛起
for (int i = listBox1.Items.Count - 1; i >= 0; i--)
{
listBox1.SelectedIndex = i;
Process myProcess = new Process();
myProcess.StartInfo.FileName = "ffmpeg.exe";
myProcess.StartInfo.WorkingDirectory = "";
myProcess.StartInfo.Arguments = " -i \"" + listBox1.SelectedItem + "\" " + "-y ";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myProcess.Start();
myProcess.WaitForExit();
listBox1.Items.RemoveAt(i);
}
轉換程序一段時間使用轉換。如何顯示正在運行的應用程序的新窗體或messengebox?我想讓它響應窗口。 歷史的循環: How do I do I loop through items in a list box and then remove that item?
的可能重複(http://stackoverflow.com/questions/22151235/in-c -sharp-how-do-you-read-from-dos-program-you-executed-if-the-program-is-const) – I4V