Having problems passing an object as param to CreateThread (C++)
Posted on 2010-08-23
I'm having problems passing an object as param to CreateThread in C++. Any help greatly appreciated!!!
This is my Thread function, defined outside the class:
static DWORD WINAPI myThreadFunction(LPVOID param);
This is the class definition:
public ref class MyClass : public MyParentClass
This is my CreateThread Call from within the MyClass object:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)myThreadFunction, this, 0, NULL);
error C2664: 'CreateThread' : cannot convert parameter 4 from 'MyClass::MyClass ^const ' to 'LPVOID'
1> No user-defined-conversion operator available, or
1> Cannot convert a managed type to an unmanaged type