How to get process threads in Windows 10 C/C++ Source Code Included.

Today I want to share with you a small tool with C/C++ code to get process threads, this tool will get all the threads in the system and show you some information about the thread and the process that run this thread.

In this guide we will focus on the following:

  • Global threads count in task manager.
  • Thread count per process using task manager.
  • A small command-line tool name ThreadsInfo with C/C++ source code.

If you are asking yourself how to check number of threads in windows you can do the following, in Windows 10:

  1. Open task manager.
  2. Go to the Performance tab.
  3. Make sure CPU is selected

You can see the number of threads currently running on your system.

Here is a screen for that:

Task Manager Show Thread Count
Task Manager Show Thread Count

But what if you want more, you want to know threads count for each running process.

No Problem, you can also do that from Task Manager. Here is how:

  1. Open task manager.
  2. Go to the Details tab.
Threads count per process
Threads count per process

If you do not see the threads count. please refer to the next paragraph.

Adding the threads count per process in task manager:

If you do not see the threads count, you can add the threads column to the items you see.

  1. Right click on one of the items in the title – number 1 in the image.
  2. Press on the select column option.
  3. In the list that opens, scroll down to threads – number 2 in the image.
  4. Mark threads and press OK.
  5. Now you can see the number of threads per process.
Add the threads count per process
Add the threads count per process

But what if you want more information about the threads.

The get process threads tool:

Get process thread tool output
Get process thread tool output – ThreadsInfo tool.

The code is base on Microsoft traversing the thread list code.

 

The ThreadsInfo command-line tool:

Using code, and API function, we can “travel” the list of threads that running on the system. But not only that we can query the thread and get information from it. In this version, we are only the thread ID, Priority and the parent name of the thread process. The exe file.

You can download the tool source code (C/C+) from:

ThreadsInfo source code (2944 downloads )

The code was build in Visual Studio 2015 but can be used in any other version. Please create a C/C++command line project to run this tool.

Hope this article – How to get process threads in Windows 10 was helpful if you have question, comments or you want us to upload a compile (exe) version of the tool. Please contact us using the contact page or comment on this article.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.