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
2010-05-01 01:06:54
This way I'll wait of thread finalization, it's not the case, tks anyway.
SaCi
2010-05-01 01:10:34
The second argument to WaitForSingleObject is a timeout. By passing 0 in it will just test the wait state and immediately return.
Craig Peterson
2010-05-01 03:13:50
+6
A:
I found the answer tks srs.
GetExitCodeThread
For more information: http://msdn.microsoft.com/en-us/library/ms683190(VS.85).aspx
SaCi
2010-05-01 01:11:31