The thing to understand is that functions (including static methods) and non-static methods are different things. CreateEvent
expects a function. You must give it that, it will not work with GPEFlat::MouseEventThread
because that's a method. What you can do though is give it a function which calls GPEFlat::MouseEventThread
. Usually this is done like this
DWORD WINAPI thread_starter(LPVOID that)
{
return ((GPEFlat*)that)->MouseEventThread();
}
...
CreateThread(NULL, 0, thread_starter, this, 0, NULL);
Note that I pass this
to CreateThread
, that's very important. CreateThread
passes it to the parameter that
in thread_starter
, which uses that
to call the method you wanted to call all along.