windows - Get notified when a process stops responding (preferably C#) -


I am thinking that there is no response to a particular process, then there is no way to listen to the incident to inform (Not when it comes out!).

This solution allows here to check whether a particular process is responding or not, but this solution can be used only with voting. It would be nice if I can "listen" to process.Responding in this solution.

As an example, I want to hear all the visual studio procedures on a Windows machine and if any of them do not react then I have to be informed that I can work on it accordingly. I am Many thanks in advance!

Something can do something like this, it is a small example of a primitive example Uses process Accountability and fire an event when it wrongens I do not think you will be able to get the process around voting from time to time, at least not in a simple / concise way.

Each task will run in a background thread, so to avoid hanging the main thread when it monitors every process.

  Using the system. threading. Task; Namespace System. Diagnostics {public-grade process processing date: eventArgS {public process process {get; Protected Set; } Public ProcessEventArgs (Process Process) {this.Process = process; }} Public Representative Zero ProcessNotRespondingEvent (Object Sender, ProcessEventArgs e); Public category process monitor {public event processing not-respondent event note-response; Safe operation process; Public process monitor {process} {this.mProcess = process; } Public async zero start () {task t = null; T = Task.Run ((=) = & gt; {while (this.mProcess.Responding) T. Wait (1000); // 1 second is OnNotResponding ();}); waiting; } Protected Zero OnNot Response () {if (this.NotResponding == empty) return; ProcessEventArgs e = New Processing Event (this .mpr.); It's not only responsive (it, E); Example} :  
  system. Internal Stable Class Program {Private Stable Zero Main () {var Processes = Process. Get process action ("devon"); Var Monitor = Process. Select (P = & gt; {Mointer = New Process Monitor (P); Monitor.Not Responding + = (S, E) => (Console.lightline ("Process {0} (PID: {1}) Has stopped responding. ", E.Process.ProcessName, e.Process.Id);}; Return Monitor;}); Foreign Monitor (Monitor in Monitor) Start (); }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -