CWinThread* AfxGetThread( );
Return Value
Pointer to the currently executing thread.
Remarks
Call this function to get a pointer to the CWinThread object representing the currently executing thread. Must be called from within the desired thread.
Example
//Print the current thread ID in the Debug Window
TRACE("Current Thread ID = 0x%X\n", AfxGetThread()->m_nThreadID);
See Also AfxBeginThread