I am trying to create a thread in an object, however I get an error saying \'&\' : illegal operation on bound member function expression.
Reading up I saw I hav
static
functions aren't bound to a particular instance; there is no this
pointer, and you have no "member variables." You can pass the this
pointer as an argument to your function, and then cast it into a Dac*
and access member variables from it.
So you could do
ping_thread = CreateThread (NULL , 0, ping_loop, (LPVOID)this, 0, &dping_thread);
And change your ping_loop
to this:
static DWORD WINAPI ping_loop(void* param)
{
Dac* dac = (Dac*)param;
while ( dac->com.dac_ping() == 0)
Sleep(900);
return 1; //since this is an infinite loop, if the loop breaks, it has failed
}