tags:

views:

279

answers:

2

I want to programmatically verify the status of an application to see if it has crashed or stopped. I know how to see if the process exists in C# but can I also see if it is "Not responding"?

A: 

See "Not Responding" Message in Windows Form Applicati at Fog Creek Software

boost
+6  A: 

Everything you need is in System.Diagnostics, for example: to check if a process is responding.

using System;
using System.Diagnostics;

namespace ProcessStatus
{
    class Program
    {
        static void Main(string[] args)
        {
            Process[] processes = Process.GetProcesses();

            foreach (Process process in processes)
            {
                Console.WriteLine("Process Name: {0}, Responding: {1}", process.ProcessName, process.Responding);
            }

            Console.Write("press enter");
            Console.ReadLine();
        }
    }
}
Student for Life