Check status of process

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

Answers


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();
        }
    }
}

Need Your Help

How to Return and consume custom struct object from C++ COM component into C# application

c# c++ .net com marshalling

I have created a simple COM component in C++ and added a method like this

How To Set a Primary Key On a View Using ROW_NUMBER()?

sql-server-2008 entity-framework primary-key

I use SQL Server 2008 and Entity Framework for an app I work on.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.