I want to use AfxBeginThread or CreateThread to create a
thread which can monitor com port in MFC Extension DLL
like following:
class AFX_EXT_CLASS CInitDll
{..};
BOOL CInitDll::StartMonitoring()
{
DWORD Tid;
if (!(m_Thread = CreateThread (
NULL,
0,
(LPTHREAD_START_ROUTINE) CommThread,
this,
0,
&Tid)
))
return FALSE;
TRACE("Thread started\n");
return TRUE;
}
DWORD WINAPI CommThread(LPVOID cOwner)
{....}
but I meet:
error C2440: '=' : cannot convert from 'void *' to 'class
CWinThread *'
How to use Create a CWinThread in MFC Extension DLL?
CreateThread is an API function that does not return a CWinThread*.
AfxBeginThread is an MFC function and does return a CWinThread* and
should always be used instead of CreateThread in MFC code.
--
Scott McPhillips [VC++ MVP]