Posted by: imampersonal | August 8, 2008

Read Running Process With C#

Berikut adalah contoh code sederhana untuk membaca proses yang sedang berjalan di komputer berbasis Windows XP. Seperti dalam contoh, proses yg sedang

berjalan tersebut akan ter-list di dalam sebuah tabel (saya memakai listview).

Download Source Code: 
http://www.ziddu.com/download/1819942/RunningProcess.rar.html

Kode selengkapnya:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RunningProcess
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process[] p = System.Diagnostics.Process.GetProcesses();

            ListViewItem lvItem;

            listView1.Items.Clear();
            for (int i = 0; i < p.Length; i++)
            {
                lvItem = listView1.Items.Add(p[i].ProcessName);
                lvItem.SubItems.Add(p[i].PagedMemorySize64.ToString("##,##0") + " bytes");
            }

        }
    }
}

Download Source Code: http://www.ziddu.com/download/1819942/RunningProcess.rar.html

Categories

Follow

Get every new post delivered to your Inbox.