Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

Get all processes running on machine using System.Diagnostics Namespace in C# .NET 2.0.

Author: Zunnair
Download Source Code : 716_GetAllProcess.zip

In this simple article you will learn that how you can get all processes running on your machine using System.Diagnostics Namespace.

Simply just create New Project of windows application in C#.

 

Import Diagnostics APIs

 

using System.Diagnostics;

 

Drag one label, one buttons and one list box on the form.

 

Now write following code on form Load event

 

private void Form1_Load(object sender, EventArgs e)

        {

            this.Text = "DevAsp Process Getting Application";

            label1.Text = "Processes Name";

            label2.Text  = "Total = ";

            button1.Text = "Get Current Processes";

        }

 

 

Now write code on buttons events

 

private void button1_Click(object sender, EventArgs e)

        {

            int count = 0;

            label2.Text = "Total = ";

            Process[] prs = Process.GetProcesses();

            listBox1.Items.Clear();

                foreach (Process proces in prs)

                {

                    count++;

                    listBox1.Items.Add(proces.ProcessName);

                }

                label2.Text += count.ToString();

        }

 

In button1_Click funtion proces object give you name of process in process list collection of system.

Article Comments
Thank you Sir,
It's very good!!!

Posted on 7/11/2008 9:36:27 AM by Rathindra Singha

Great sir ji !!!!!!!!!!!!!!!!
Thank you

Posted on 2/20/2010 12:40:36 AM by Rajeev Mishra

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< Count total number of word file pages using Microsoft Office APIs in C# .NET 2.0.

Disclaimer - Privacy
© 2002-2017 DevASP.net