January 29th, 2004, 09:03 AM
Spawning a class member function into a thread
Is it possible to spawn a class member function into a thread?
I try to do that, but get this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned long (__stdcall *)(void *)'
For example, can we have something like this
DWORD WINAPI ThreadFunction(LPVOID lparam);
m_hThread = CreateThread(NULL, NULL, ThreadFunction, NULL,
January 29th, 2004, 09:07 AM
Take a look at the following FAQ...
January 29th, 2004, 10:33 AM
Define the member function as a static public member fuction. Include "__stdcall" so the compiler will accept it.
Click Here to Expand Forum to Full Width