Subj : Re: Question about: createthread/beginthread/beginthreadex ? To : comp.programming.threads From : Phil Frisbie, Jr. Date : Tue Mar 15 2005 12:36 am mandatory wrote: > Well - now we have two different answers out of two posts ? can see why im > confused ? Threads on Windows are very confusing due to the way Microsoft extends APIs. Like Mikhail said, if you are using the C run-time then you must use _beginthreadex() to create a thread that will not leak memory. If you are only using the Win32 APIs, then you can use CreateThread(), but if you are using MFC then you must use AfxBeginThread(). > Now, in my Win32 documentation i cant find AfxBeginThread() - where is this > located, which header ? It is part of MFC, in afxwin.h. > And does this mean that AfxBeginThread() is THE one to use - anyone disagree > ? Since the MFC source code shows that AfxBeginThread() calls _beginthreadex(), if you don't mind linking to MFC and using C++ it should work in all cases. Personally, I still avoid C++ for portable code, but that is my own preference. -- Phil Frisbie, Jr. Hawk Software http://www.hawksoft.com .