AfxEndThread
Visual Studio 2012
Call this function to terminate the currently executing thread.
void AFXAPI AfxEndThread( UINT nExitCode, BOOL bDelete = TRUE );
Must be called from within the thread to be terminated.
For more information on AfxEndThread, see the article Multithreading: Terminating Threads.