views:

39

answers:

1

I want to use shell executable in order to respect user preferences of application to be started, but I also need to know when that particular application is closed.

Process editProcess = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = filename;
startInfo.Verb = "edit";
startInfo.UseShellExecute = true;
editProcess.StartInfo = startInfo;

// start the default editor
editProcess.Start();
editProcess.WaitForExit();

WaitForExit seems to return when the shell process exits and not when the real process exits.

Is there a better way of knowing when started application is exited than manually parsing registry, finding correct application to start and explicitly start that app without shell execute?

A: 

Handle the process exited event:

editProcess.Exited += process_Exited;
Dan
I tried that as well, but that behaves in the same undesired way, namely fires when shell process? exits and the started application is still running..
mostlytech