According to MSDN:-
The System.Diagnostics namespace provides classes that allow you to interact with system processes, event logs, and performance counters.
The
Simply speaking, using an object of Process class you can get a list of all processes running on system. Its member GetProcesses provides an array of all processes running on the system. Its overload GetProcesses(strMachineName) allows you to do the same for a machine on the network.
If you need to check a particular process, there is a member GetProcessesByName(strName) using which you can provide the string parameter containing the name of process.
Let's see a coding example. I want to find all processes of "notepad" running on my machine and want to know what time each of them was started. Here is how its done in VB.net.
Imports System.Diagnostics 'put it on top of page
Dim localByName As Process() = Process.GetProcessesByName("notepad")
Dim NotePadProc As Process
MsgBox("Total number of processes found: " & LocalByName.Length)
' if Length property is zero, means no such process running.
For Each NotePadProc In localByName
MsgBox(NotePadProc.StartTime)
Next
Join the conversation! Your thoughts help the community grow.