Hallo, when I use class and I put one of the member function as the CreateThread argument, I keep getting the compile error in Visual Studio 2005.
What should I put for the third argument of CreateThread ? Thank you.
Code:
#include <windows.h>
class X {
public:
void f();
void s(){};
};
void X::f()
{
//error C2664: 'CreateThread' : cannot convert parameter 3 from 'void (__thiscall X::* )(void)' to 'LPTHREAD_START_ROUTINE'
HANDLE hThread = CreateThread(NULL, 0, &X::s, (void *) 1, 0, NULL);
//error C3867: 'X::s': function call missing argument list; use '&X::s' to create a pointer to member
HANDLE hThread2 = CreateThread(NULL, 0, s, (void *) 1, 0, NULL);
}
int main() {
return 0;
}
Comment