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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -