Win32:我如何枚举属于C ++中的一个进程的所有线程?
可能重复:
枚举Windows中的主题
我想枚举所有属于
我知道我可以这样获得进程ID:
I know I can get the process ID like so:
PDWORD procId;
GetWindowThreadProcessId(hwnd, procId);
我知道整个事情可以在C#中完成,如下:
And I know that the whole thing can be done in C# like so:
// get process that owns the taskbar window
int procId;
GetWindowThreadProcessId(hwnd, out procId);
Process p = Process.GetProcessById(procId);
if (p != null)
{
foreach (ProcessThread t in p.Threads)
{
...
}
}
但是据我所知,Process类是一个.NET类我错了),我试图我最难避免.NET依赖。 (阅读:请不要告诉我只使用.NET。)
But as far as I can tell the Process class is a .NET class (please correct me if I'm wrong), and I'm trying my hardest to avoid .NET dependency. (Read: Please don't tell me to just use .NET.)
所以问题是这样:有一个Win32等同, PID?
So the question is this: Is there a Win32 equivalent, given that I have correctly retrieved the PID?
(另外,我看到了工具帮助库在另一个问题中引用,但不确定是否是最好的选项。如果是,可以给出 >
(As a side note, I saw the Tool Help Library referenced in another question, but was not sure it was the best option. If it is, could you give a brief explanation/demonstration of how I would accomplish this or direct me to someone else's?)
一如往常,非常感谢所有的帮助。
As always, thanks immensely for all the help.