Thursday, 5 September 2013

Closing Application Using C#

Closing Application Using C#

I am Using a c# Form Application and I want to know how can I exit
environment if the process conquer.exe was closed. I am Using this Code in
a Timer but nothing happens if conquer.exe was closed.
foreach (System.Diagnostics.Process exe in
System.Diagnostics.Process.GetProcesses())
{
if (exe.ProcessName.StartsWith("conquer"))
{
exe.WaitForExit();
if (exe.HasExited)
{
Application.Exit();
Environment.Exit(0);
}
}
}

No comments:

Post a Comment