Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Anybody knows how to programmatically retrieve the handle count and thread count of the running process?
I mean, similar to the Task Manager, each process has its handle and thread counts opened.
I appreciate for your help guys. Thanks so much!

All I know about how to get the thread counts is to instal the WinNT recource kit, open Wperf.exe, hit SELECT, and check Thread Count.
Hope this is helpful!
dellano

The easiest way to get the threads or handles used by a process is to first to get the process info and then retrieve the desired info as shown below -
Process appProcess = Process.GetProcessById(processId); // Can get process by name also
int threads = appProcess.Threads.Count;
int handles = appProcess.HandleCount;As this information is a snapshot of the process, calling the Process.Refresh() method at desired intervals is required to get the latest counts.

![]() |
How to backup
|
Windows NT Server 4.0
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |