private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = openFileDialog1.FileName;
ProcessStartInfo info = new ProcessStartInfo();
info.WindowStyle = ProcessWindowStyle.Hidden;
info.FileName = "WK01.exe";
info.Arguments = "WK01.exe";
info.Arguments = fileName;
Process p = new Process();
p.StartInfo = info;
p.Start();
p.WaitForExit();
}
}
當我運行這段代碼,在p.Start();
這段代碼休息,因爲我WK01.exe項目包含2個參數,一個是它的路徑和第二個是我給它喜歡的圖片或任何東西,當我運行它,並按下按鈕時,它會要求我選擇文件,當我選擇該文件時,它會中斷程序p.Start();
程序違反工藝類
爲什麼需要cmd.exe呢? – Agat
並談到「休息」......實際上發生的例外是什麼? – Agat
爲什麼cmd.exe? WK01是我的C++項目,它的獲取命令行參數,第一個參數顯然是它的路徑,第二個是我的輸入 – AHF