|
This course - Getting a list
of running processes v1.0 - last updated: 08/07/2006 |
// you'll need the following using at the top of the file to get processes:
// using System.Diagnostics;
listBox1.Items.Clear(); // this is a ListBox
myProcessList.Clear(); // this is an ArrayList
// blank or clear other GUI widgets here
Process[] myProcesses = Process.GetProcesses();
try
{
foreach (Process proc in myProcesses)
{
myProcessList.Add(proc);
listBox1.Items.Add(proc.ProcessName);
}
}
catch { } // suppress any errors during process search
// update form title to show number of processes found (use myProcessList.Count.ToString())
// maybe update the message in the status bar also...
Visitors: