Reputation: 2947
First, sorry about question title, if there are better suggestions, I'm opened to them.
What I do is I have a program which launch an executable. I have no control over the executable. Executable may crash (then option to send reports, and everything).
What I'd need to do, is if it crashes, the one which launches it would need to notice, and shut the executable.
Is there a way to have this control?
Upvotes: 0
Views: 98
Reputation: 2470
If you are using Process.Start then you can wait for the process to complete using Process.WaitForExit() like so:
var proc = Process.Start(...);
proc.WaitForExit();
If you aren't launching the process with Process.Start and this is an existing process then you can use Process.GetProcessByName or Process.GetProcessById first and then wait on it.
It is worth noting though that this won't return until the error report dialog has been dismissed.
Upvotes: 4