Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have some windows application .exe which are run in my Domain server, i have a problem that if the .exe is stooped how can i get the notification that the .exe has stooped.

is there any solution thru i can manipulate my code with operating system and get notification thru mail or any other resource
Posted
Comments
Sergey Alexandrovich Kryukov 25-Feb-14 1:12am    
Your tags are mess. I cannot believe it could be Objective-C, C# and VB.NET at the same time...
—SA

1 solution

If you started some process in your code, you can capture the even when it is stopped, but, normally, you would need to handle it in a separate thread. This is not very expensive even if you want to track several external processes requiring a separate tracking thread per process, because most of the time such thread would be in the wait state, wasting no CPU time.

It could looks like this:
C#
using System.Diagnostics;

//...

void SomeThreadStartMethod() {
    Process someExternalProcess = Process.Start("...", "..."); // some parameters
    someExternalProcess.WaitForExit();
    // invoke some event or handle it somehow...
}


If you are not starting your process in your server, you still can get the list of processes, choose one by some criteria and use a references to it to do the same wait. Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900