I know that on Code Project there are a lot of process managers programmed by brilliant programmers. But I need some more functionally in these process managers. Therefore I created my own task manager.
Why I created this process manager, the reason is that sometimes we need to release our memory in just a short time. It takes time to select unnecessary processes from the Windows task managers and kill them one by one. While running some games or any other programs that require high RAM when you have shortage of RAM, this poses a problem. You'll want to use the RAM by only system processes and your favorite processes.
Point of Interest
You can create a list of programs and after opening the program MyTaskManager.exe, you will press the button "kill list processes." All of the process you add to the kill list will kill automatically. One thing I keep in mind with this program is that if there is some precious process, like system processes and maybe some other processes, you may not want to stop them at any cost. You must therefore add them to the except list. This process will never kill, although you add it in the kill list or attempt to kill it by mistake.
How It Works
It also reads the files Kill_List.xml and Except_List.xml. Keep the information while running the program. You can add a program to the kill list by right clicking on the process to add and then adding it to the list. The kill list is the list that the user will kill the processes with by clicking the button "kill list processes." The except list is the list of processes that you want to not kill at any cost, whether you add them to the kill list by accident or select for them for killing. It works like Task Manager, but I added some things that are following, through which you can get some extra work done.
After right clicking on the process, you can choose one of four operations for the selected process.
- You can open the folder containing the process.
- You can kill the selected process if it is not in the except list.
- You can add it to the except list.
- You can add it to the kill list.
By clicking the kill list, it will kill all the processes that you've added to the kill list. View kill list and view except list to get data from the files Kill_List.xml and Except_List.xml and to view your processes in both categories. "New Task" just works like "Run" in the Windows menu.
In this program, I get all processes of the system through the function
string Mem_Usage = new string;
string ProcessNames = new string;
process = Process.GetProcesses();
noOfProcess = 0;
int i = 0;
ListViewItem lvi = new ListViewItem();
foreach (Process pro in process)
String pathx = "";
pathx = pro.Modules.FileName;
pathx = pathx.Replace("\\??\\", "");
path[i] = pathx.ToString();
path[i] = "";
ProcessNames[i] = pro.ProcessName;
Mem_Usage[i] = Convert.ToString(pro.PagedMemorySize64);
lvi = new ListViewItem(ProcessNames[i]);
After getting processes, we use one function,
ReadXmlFile, for both the Except_List.xml and Kill_List.xml files.
public void ReadXmlFile(string filename)
reader = new XmlTextReader(filename); reader.WhitespaceHandling = System.Xml.WhitespaceHandling.None;
PInKill_List = new string;
bool bEnableProcessNamesContent = false;
bool bEnableProcessContent = false;
int i = 0;
(reader.Name == "PorecessNames");
bEnableProcessContent = (reader.Name == "Process");
txtbox.Text += reader.Value + "\n";
PInKill_List[i] = reader.Value;
PInKill_List[i] = PInKill_List[i].TrimEnd('\r');
check = false;
} catch (Exception)
I use the timer event to check processes after a specific time.
public System.Timers.Timer timer = new System.Timers.Timer(4000);
The default time is 4 seconds, but the user can change the time of the refresh rate from 1 second up to 8 seconds. After the timer event call, I call the function
Check4Process, which will compare the number of old processes with the number of new process. If it is the same, then leave it. If not, then the
GetProcesss function will call again and add it to the list view control.
private void Check4Processes()
Process gPro = Process.GetProcesses();
int Numpro = 0;
string names = new string;
string mem = new string;
foreach (Process pro in gPro)
names[Numpro] = pro.ProcessName;
mem[Numpro] = Convert.ToString(pro.PagedMemorySize64);
if (Numpro < noOfProcess)
if (Numpro > noOfProcess)
Kill_List, the function
Check_Porcess_In_ExceptList is used when we are going to kill any process. We check whether it exists in the except list or not and return the bool value.
public bool Check_Process_in_ExceptList(string toCheck, Kill_List Except_Obj)
string pNames = Except_Obj.txtbox.Text;
bool found =false;
string SingleProcessName = ConvertStringToStringArray(pNames);
foreach(string str in SingleProcessName)
found = true;
- 30 August, 2007 -- Original version posted