Enumerating Applications


Click here to change the theme.

The majority of this article is a rewritten version of Microsoft Knowledge Base (KB) Article  How To Enumerate Windows Using the WIN32 API. That article says that it describes how to enumerate applications in each of the two manners that the Windows Task Manager does. The first two tabs of the Windows Task Manager are:

  • Applications showing top-level windows
  • Processes showing programs, many of which do not create windows

Since Applications is actually top-level windows, that view can easily be created using the EnumWindows() function. The KB article does not show a sample use of the EnumWindows() function but I have one in EnumWindows.

Enumerating processes is more complicated in many ways. One way is that the process is different for Windows NT than for all other Win32 operating systems. The ToolHelp32 Library can be used to enumerate processes for all versions of 32-bit Windows except NT. The PSAPI library of APIs must be used for NT. The KB article has sample code that shows how to use both the ToolHelp32 Library and the PSAPI library.