views:

183

answers:

2

When I create a thread I save it handle in a list. After a time I want to check which of them still exists. I'm not looking for other kind of implementation, I want to know if is there some how to get a thread by it handle ?

+3  A: 

If you're just interested in which ones are still running, this should work:

if WaitForSingleObject(ThreadHandle, 0) = WAIT_OBJECT_0 then
  // Thread is still running
Craig Peterson
This way I'll wait of thread finalization, it's not the case, tks anyway.
SaCi
The second argument to WaitForSingleObject is a timeout. By passing 0 in it will just test the wait state and immediately return.
Craig Peterson
+6  A: 

I found the answer tks srs.

GetExitCodeThread

For more information: http://msdn.microsoft.com/en-us/library/ms683190(VS.85).aspx

SaCi