Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Get All Process in c-sharp

Article:
Viewed:  1322 
Posted On:  26/06/2013 12:48:36 
How we can get all process in c# ? 

In this article I am going to show how we can get all running process name and their Id in c#. For this we need System.Diagnostics namespace.

My Output:

1.png

Image 1.

My xaml.cs is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;
 
namespace GetAllTaskList
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        } 

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Process[] processes = Process.GetProcesses();

            foreach (Process pro in processes)
            {
                listBoxAllProcess.Items.Add(pro.Id + " - " + pro.ProcessName);
            }
        }
    }
}

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us