These days see process components, very interested in, so do such an dongdong, to not for anything else, is familiar with the process provided by the various properties and methods bar. The program is very simple, thanks to the process encapsulation of a lot of useful methods, direct call on it, if you have to be familiar with which attribute represents what the meaning of what the method is. The form mainly uses Istview control to enumerate the process and its related information, there are two problems have not been resolved, there are experts passing the hope to enlighten.
The first is to simulate the directory where the open process of the Longhorn Task Manager is to be opened only to the folder where the process is located, and to select the process file one step at a time.
Another issue is the use of a timer in the program to automatically update the process list information, to obtain the system all process information This code is as follows:
Get all current process information and populate ListView
private void Getcurrentinfo ()
{
ProcessList.Items.Clear ();
myprocess = Process.getprocesses ();
foreach (Process PR in myprocess)
{
pr. Refresh ();
string[] str = {
pr. ProcessName,
pr. Id.tostring (),
pr. Totalprocessortime.tostring (). Substring (0,8),
(double) pr. workingset/1024). ToString ("0.##") + "K",
(double) pr. virtualmemorysize/1024). ToString ("0.##") + "K",
pr. Basepriority.tostring (),
pr. Responding==true? " Running ": Lost Response"
};
PROCESSLIST.ITEMS.ADD (new ListViewItem (str));
}
}
As written, emptying all items in the ListView before each update, and then getting all of the current process information and enumerating the padding, causing the problem of losing the ListView before the update Selectindex, This raises a number of other problems that depend on selectindex operations. Is there any good way to get ListView to be updated without all the cleaning?
Screenshots:
Code Download: Http://210.29.131.64/person/ml/private/MyTaskManager.rar