May 17th, 2010, 12:40 AM
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 17th, 2010, 12:46 AM
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