Properties of Running Processes


About Classes used

 Process class, provides an access to local & remote processes, also enable to start & stop local system processes. Using the Process component, we can obtain a list of the processes that are running, or can start a new process.

Namespace Required - System. Diagnostics

Here I implemented the Code for enlisting the properties of running processes of the local system.

The Code: (do necessary changes)

1. Access the Running Processes (ProcessID & ProcessName) (code for “Refresh” Button).

            //Look for Currently Running Processes
            foreach (Process var in Process.GetProcesses())
                     ListViewItem item = newListViewItem(var.MainModule.ModuleName);
                     lvProcesses.Items.Add(item); //Add Process Name & ID to ListView
                  }catch (Exception) { //Add code for Exception (if any) }

Listing 1

2. Display the Properties of Selected Process (code for “Show” Button)

            // Get ProcessID of Selected Process From Listview
            Process P = Process.GetProcessById(Convert.ToInt16(“SelectedProcess”);
                lblDescription.Text = "File Description : " +

          lblCompany.Text = "Company Name : " +

                lblVersion.Text = "Version : " +  

                lblCopyright.Text = "Copyright : " +

                lblTrademark.Text = "Internal Name : " +

                lblLanguge.Text = "Language : " +

                txtPath.Text = P.MainModule.FileVersionInfo.FileName;

            catch (Exception) { //Add code for Exception (if any)  }

Listing 2

3. Now execute the Application and see the result (Figure 1).

Intended Result:

New Picture (1).png

Figure 1


In this piece of writing, using C# environment, we have seen how to access the properties of running properties on the local system

Ebook Download
View all
View all