0
public void processloader(object temp) 
{

    Process[] processes = null;
    try
    {
        processes = Process.GetProcesses();
    }

    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
        Application.Exit();
        return;
    }
    listView1.BeginUpdate();
    listView1.Clear();
    int threadscount = 0;
    listView1.Items.Clear();
    foreach (Process p in processes)
    {
        try
        {
            string[] prcdetails = new string[] { p.ProcessName, p.Id.ToString(), p.StartTime.ToShortTimeString(), p.PriorityClass.ToString(), (p.WorkingSet64 / 1048576).ToString() + "Mb", p.Threads.Count.ToString() };
            ListViewItem proc = new ListViewItem(prcdetails);
            listView1.Items.Add(proc);
            threadscount += p.Threads.Count;
        }
        catch { Console.WriteLine(p); }
    }
    statusBar1.Panels[0].Text = "Processes : " + processes.Length.ToString();
    statusBar1.Panels[1].Text = "Threads : " + (threadscount + 1).ToString();
    listView1.EndUpdate();
    listView1.Refresh();


}

这是我使用 System.threading.timer() 每秒调用此函数的刷新器块。我需要一个像原始任务管理器刷新功能这样的解决方案有人可以帮忙吗?请提供一些示例代码。提前致谢!

4

1 回答 1

0

使用以下链接对您的问题有帮助:

http://social.msdn.microsoft.com/Forums/eu/csharplanguage/thread/f8cb71ef-aba6-42f6-a462-533bca201d9e

于 2012-07-18T15:17:33.723 回答