The function pointer that CreateThread expects must have this signature:
DWORD WINAPI ThreadProc(LPVOID lpParameter);
When you create a member function, it receives the invisible parameter "this" as the first argument, so you declare something like this implicitly:
DWORD WINAPI ThreadProc(BackgroundWorker *this, LPVOID lpParameter);
Create a static member function to omit this pointer, and if you need this pointer inside a thread routine, pass it as the void * parameter
source share