System Programing

 

Saturday, May 30, 2009

How to Monitor a Process

using System;
using System.Windows.Forms;

namespace DevDistrict.MachineMonitor
{
public class Monitor
{
[STAThread()]
public static void Main()
{
System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcessesByName("Notepad");

if (p.Length<0)
{
Console.WriteLine("No process");
return;
}

if (p[0].HasExited)
{
Console.WriteLine("Process Exited");
return;
}

p[0].Exited+=new EventHandler(Startup_Exited);

while(!p[0].HasExited)
{
p[0].WaitForExit(30000);

Console.WriteLine("checking process health");
}
}

private static void Startup_Exited(object sender, EventArgs e)
{
Console.WriteLine("PROCESS EXIT CAUGHT");
}
}
}

3 comments:

  1. hi,

    i have a question can you please send me the code to read specific text of rtf files making them bold, italic, changing the color of text etc etc and converting it to pdf documnet using abcpdf7.
    i have done conversion but not able to do do changes at chosen text.
    i have used the below code but it applyes to whole document i want to do the changes at specific location


    string theFont = "Comic Sans MS";
    theDoc.Font = theDoc.AddFont(theFont);
    theDoc.AddText(theFont);
    but these changes applies to whole document.
    mail me at naveen.pujari84@gmail.com

    ReplyDelete
  2. I thing The dll(abcpdf7) is 3rd Party Tool Better you contact (abcpdf7) provider.

    ReplyDelete
  3. hi sir.i am a student of engg and i am making project of online salary management in asp.net 3.5.so sir,if you can provide me some projects or references related to project.then it would be great helpful to me.i am beginner n confused about where or how to start my project.if you help me then it can be great pleasure for me...thank you...
    MY EMAIL ID vishveshraval@ovi.com

    ReplyDelete

All Menu