Hi, AfxBeginThread() gives me error C2665:
This is my thread function:
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'UINT (LPVOID)'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(4108): could be 'CWinThread
*AfxBeginThread(CRuntimeClass *,int,UINT,DWORD,LPSECURITY_ATTRIBUTES)' while trying to match the argument list
UINT ListenToClient(LPVOID pParam);
UINT CServerDlg::ListenToClient(LPVOID pParam)
int index = 0, iReturn;
How to fix this please?
Don't use a class member function.
and use correct function prototype
To me, the function prototype looks fine.
But an alternative would be to inherit CWinThread into CServerDlg, and passing an instance of the class into the AfxBeginThread - although I'm not sure that's what you actually want to do.
I made my own template function to wrap AfxBeginThread to be able to thread within class member functions, in case anyone wants to use it.
It's templates and may be a bit hard to understand, but it's standards compliant C++.