O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Find Other Running Processes

Problem

You want to retrieve information about processes that are currently running.

Solution

Use the GetProcesses or GetProcessesByName methods of the System.Diagnostics.Process class.

Discussion

The System.Diagnostics.Process class represents a Windows process. It provides an exhaustive list of properties, which are detailed on MSDN. Using this information, you can

  • Examine an application’s memory, thread, and CPU usage.

  • Determine when an application started and how long it has been executing.

  • Retrieve information from the executable file that was used to launch the application.

You can also use the Process class methods to end a process (as described in recipe Terminate Another Process), and you can handle the Process.Exited ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required