A Task Manager for C # implementation

Source: Internet
Author: User
Tags tostring

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




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.