を検出:FileSystemWatcherは.exeファイルが保存さになっているフォルダを見ているC#が、私は次のコードしているプロセスの終了
private void fileSystemWatcher_Changed(object sender, System.IO.FileSystemEventArgs e)
{
System.Diagnostics.Process execute = new System.Diagnostics.Process();
execute.StartInfo.FileName = e.FullPath;
execute.Start();
//Process now started, detect exit here
}
。そのフォルダに保存されたファイルは正しく実行されます。しかし、開いたexeが閉じると別の関数が起動されるはずです。
これを行う簡単な方法はありますか?
このMSDNのページによると、(http://msdn.microsoft.com/en-私たち/ライブラリ/ system.diagnostics.process.exited(v = vs.110).aspx) 'execute.WaitForExit()'が正しく動作するためには 'execute.EnableRaisingEvents = true'を設定する必要があります。 –