Originally Posted by
Codeplug
>> what is the difference
AfxBeginThread is part of the MFC framework/library. If you use threading in an MFC application/dll, and that thread uses any other MFC objects/functions, then you should use AfxBeginThread.
AfxBeginThread uses _beginthreadex. This is the CRT's thread creation API. If your thread uses any of CRT fucntions, then it should use _beginthreadex to avoid certain types of memory leaks.
CreateThread is the OS interface for thread creation in user mode applications. So you have AfxBeginThread -> _beginthreadex -> CreateThread.
For each of the interfaces, you can get the thread handle for use in Win32 API functions. With the MFC interfaces, using the raw handle safely is a little more tricky as there are some rules that need to be followed.
gg