getting a thread state in c++/windows

倾然丶 夕夏残阳落幕 提交于 2019-12-02 05:01:38
Tony

You can use the following examples to get the running processes and, when you have a process ID, the threads.

Taking a Snapshot and Viewing Processes

Traversing the Thread List

EDIT: After getting the handle to the thread(s) you are interested in you can call GetExitCodeThread but that will only tell you if the thread is STILL_ACTIVE until it ends, when you can find the exit code.

While searching for the additional information for your comment I also came across this thread on SO which might be of interest to you.

That's done via Toolhelp library, check information at MSDN : http://msdn.microsoft.com/en-us/library/ms686780%28v=VS.85%29.aspx

You get the most bang out of WMI, Win32_Thread class. The linked article has a link to the C++ code you need. Experiment with the WMI Code Creator tool.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!