In computing, a
process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently. -
wikipedia
Here in this tutorial, we will create a program that will show processes in the computer.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to
File, click
New Project, and choose Windows
Application.
2. Next, add only one Button named
Button1 and labeled it as "Show Process" and one ListBox named
ListBox1. You must design your layout like this:
![design](https://www.sourcecodester.com/sites/default/files/processdesign.png)
3. Now put add this code for your code module. This code is for
Button1_Click:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim a As System.Diagnostics.Process
For Each a In System.Diagnostics.Process.GetProcesses()
ListBox1.Items.Add(a.ProcessName)
Next
End Sub
Explanation:
First, we clear all the items in listbox. We initialized a
variable a as our
System.Diagnostics.Process.
System.Diagnostics.Process Class provides access to local and remote processes and enables you to start and stop local system processes.
Process.GetProcesses Method in the for each loop means creating an array of new process components and associates them with existing process resources. Then the ListBox will hold and display all the processes in your computer. The
ProcessName property holds an executable file name, such as Outlook, that does not include the .exe extension or the path. It is helpful for getting and manipulating all the processes that are associated with the same executable file.
Output:
![output](https://www.sourcecodester.com/sites/default/files/processoutput.png)
Download the source code below and try it! :)
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz