- using System;   
- using System.Collections.Generic;   
- using System.ComponentModel;   
- using System.Data;   
- using System.Drawing;   
- using System.Text;   
- using System.Windows.Forms;   
- using System.Diagnostics;
- namespace WhbServerTask   
- {   
-     public partial class Form1 : Form   
-     {   
-         private string ExeName = "DOS_XXT";   
-         private string ExePath = @"E:\DOS_XXT.exe";   
-         private bool RunFlag = false;   
-         private Process[] MyProcesses;   
-         public Form1()   
-         {   
-             InitializeComponent();   
-         }   
-         private void timer1_Tick(object sender, EventArgs e)   
-         {   
-             whbtask();                      
-         }         private void whbtask()   
-         {   
-             listBox1.Items.Add(DateTime.Now.ToString() + ": " + " 程序轮询,运行正常!");   
-             MyProcesses = Process.GetProcesses();   
-             foreach (Process MyProcess in MyProcesses)   
-             {                   
-                 
-                 if (MyProcess.ProcessName.CompareTo(ExeName) == 0)   
-                 {   
-                     RunFlag = true;                       
-                 }                   
-             }   
-             if (!RunFlag)
-             {   
-                 System.Diagnostics.Process.Start(ExePath);   
-                 listBox1.Items.Add(DateTime.Now.ToString() + ": " + ExePath+" 程序重新启动一次!");   
-                    
-             }   
-             RunFlag = false;   
-               
-         }   
-         private void button1_Click(object sender, EventArgs e)   
-         {   
-             listBox1.Items.Clear();   
-         }   
-         private void Form1_Load(object sender, EventArgs e)   
-         {   
-             listBox1.Items.Add("说明:本程序为" + ExePath + "的运行监控程序,每1小时轮询一次,如果" + ExePath + "异  
- 常关闭,则自动重启该程序!");   
-         }   
-     }   
- }  
c#监控程序
原文:http://www.cnblogs.com/liushunli/p/5019728.html