Im trying to handle process exit (when user kill process from task manager) as below. But when I open the exe it opens multiple instances of same EXE.
    Process myProcess = null;
    String fileName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
    myProcess.StartInfo.FileName = fileName;
    myProcess.StartInfo.CreateNoWindow = true;
    myProcess.EnableRaisingEvents = true;
    myProcess.Exited += new EventHandler(myProcess_Exited);
    myProcess.Start();
    Application.Run(new launchAuthentication());
private static void myProcess_Exited(object sender, System.EventArgs e)
{
    log.Info("myProcess_Exited");
}
How to prevent it?
 
     
    