title: Determining if a thread has exited
body: <p>I create new threads with <code>AfxBeginThread</code>. I have tried exiting the thread with AfxExitThread and just returning a value. Both of those are supposed to be valid ways of exiting the thread.</p>
  
  <p>However when making calls to <code>GetExitCodeThread</code> I get <code>STILL_ACTIVE</code> even after several hours. Also when using <code>(WaitForSingleObject(ahtRespondThreads[i], 0) == WAIT_OBJECT_0)</code> shows that the thread object is still valid.</p>
  
  <p>How are you supposed to tell if a thread has truly exited or not? Yes I know I could set some variables before the function exits but I would think I should be able to query the thread handle to know that it has exited or isn't a valid thread anymore.</p>