c# - Process.Exited only fires when using Windows Applications -


i have been trying solve few days, program starts process (gui application such notepad or (metro) images) this:

system.diagnostics.process execute = new system.diagnostics.process(); execute.startinfo.filename = (system.io.path.gettemppath() + @"{nr6t7yhygfdgy77fm74766jtf63ij78899dv884}\" + system.io.path.getfilenamewithoutextension(app.args[1])); execute.enableraisingevents = true; execute.exited += delegate {     file.delete(system.io.path.gettemppath() + @"{nr6t7yhygfdgy77fm74766jtf63ij78899dv884}\" + system.io.path.getfilenamewithoutextension(app.args[1]));     app.current.shutdown(); }; execute.start();   

then calls this.hide() become equivalent of background process. problem is, if open file opens word, photos(metro) or other app can uninstalled execute.exited never fires. if open file opens notepad, paint or other app can't uninstalled execute.exited does fire.. have been able rule out potential problems:

  1. since execute.enableraisingevents = true; process raising events.
  2. nothing blocking code unlike this
  3. i have tried using process.waitforexit(); doesn't work either

please guys.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -