Yesterday, I described how to get the process of a window. Today I show you how to obtain the threads of a process.

There are two ways to retrieve all the threads of a foreign process.

  1. Use the Tool Help Library. There is also a sample about enumerating threads. So I am not going to to show you code in Delphi. The sample is simple enough to understand and convert.
    But these functions are necessary.

    The Tool Help Library declarations are defined in JwaTLHelp32.pas or JwaWindows.pas

  2. Use Performance Data Helper as described in a CodeProject article.
    The PDH declarations are defined in JwaPdh.pas, JwaPdhMsg.pas or JwaWindows.pas

Tell me how you liked this blog entry by adding a comment.