9

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"?

Niklas Winde
  • 1,761
  • 3
  • 23
  • 33

2 Answers2

11

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
  • 1,023
  • 1
  • 9
  • 18
0

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

bugmagnet
  • 7,631
  • 8
  • 69
  • 131