Listing Processes – Part 2: Using PSAPI

A previous article shows how to list running processes from command line. Next, we’ll see how to get a list of processes in our own programs. Let’s start by using Process Status API (PSAPI).

Using PSAPI

Here is an example that calls EnumProcesses PSAPI function, then fills an array with the found process identifiers.

Once having the process identifiers, we can call OpenProcess to get process handles, then use the handles in other functions which get info about processes. Next example fills a listview control with process identifiers, names and image file paths.

Demo project

The demo project is a simple MFC dialog-based application that uses the above functions.
Download: Listing_Processes_Using_PSAPI.zip (879)

Using PSAPI - Demo Application

Using PSAPI – Demo Application

Resources

See also

Leave a Reply