Subj : Re: Question about: createthread/beginthread/beginthreadex ? To : comp.programming.threads From : David Hopwood Date : Mon Mar 14 2005 10:38 pm mandatory wrote: > hi, > > Ive been used to use createhread() - then ive seen some examples with > beginthread() - and some references til beginthreadex(). Always create Windows threads using AfxBeginThread, since AFX threads will work in any context, whereas threads created using CreateThread or _beginthread[ex] will break [*] or leak resources in programs that use MFC. See "The n Habits of Highly Defective Windows Applications", . Even if you don't think you are using MFC, third-party libraries (and some non-obvious MS libraries) may use it, or you may need to use it in future. It's easier to just use AfxBeginThread from the start. [*] they can break in quite subtle ways. For example, in one program I worked on, a non-AFX thread that used a third-party component which called MFC socket APIs worked to some extent, but performance was terrible due to MFC timers not being initialized correctly. -- David Hopwood .