Process process1 = new Process();
process1.StartInfo.FileName = "NotePad.exe";
process1.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
process1.Start();
Process[] p = Process.GetProcessesByName("NotePad");
if (p.Length >0)
{
if (!p[0].HasExited)
{
if (p[0].Responding)
{
p[0].CloseMainWindow();
}
else
{
p[0].Kill();
}
}
}