|
-
Jul 5th, 2001, 10:09 PM
#1
Thread Starter
PowerPoster
AfxBeginThread & AfxEndThread
In normal Win32, we can create a thread with CreateThread and therminate it anywhere with a valid thread handle will do (CloseThread).
But in MFC, we create a thread with the AfxBeginThread and terminate it within the thread itself by AfxEndThread. So, does there any way for me to terminate the thread outside the Thread?
regards,
Chris.C
-
Jul 5th, 2001, 10:52 PM
#2
Can't you just create a thread like you would in a normal non-MFC Win32 App?
-
Jul 6th, 2001, 09:25 PM
#3
Hyperactive Member
A worker thread will end when the function ends either by return or by calling AfxEndThread with a return parameter.
You terminate a thread from outside by decalring a handle to thread outside of the thread, then get the m_hThread member inside the thread, then you can use TerminateThread(handle) but that is dangerous.
For a really good article on using worker threads check out this link
http://www.codeproject.com/threads/usingworkerthreads.asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|