May 16th, 2010, 11:40 PM
Kill a thread started by AfxBeginThread
myThread = AfxBeginThread(ThreadFunction, this, THREAD_PRIORITY_NORMAL, 0, 0);
If I want to kill this thread, how to do that?
Rate the posts which you find useful
May 16th, 2010, 11:46 PM
Re: Kill a thread started by AfxBeginThread
To kill the thread get the thread handle m_hThread from myThread and call TerminateThread on the handle. Be warned though that terminating threads in this fashion is not recommended, the proper way is to signal your thread somehow to close on its own and wait for its closure in the main thread.
Tags for this Thread
Click Here to Expand Forum to Full Width