Hi,
this shall be quite easy. Member callback function shall be
static and should accept at least one parameter that is the pointer the
callback object, which is an instance of the class that has the callback method.
The following class has a callback method _MyCallbackMethod:
class CMyCallbackClass
{
public:
static void __stdcall _MyCallbackMethod(void* pObject, int iMyParam>)
{
CMyCallbackClass* pThis = reinterpret_cast<cmycallbackclass*>(pObject);
pThis->MyCallbackMethod(iMyParam);
}
void MyCallbackMethod(int iMyParam)
{
}
};
And finally, you give another object a pointer to the static method _MyCallbackMethod to another class:
class X
{
public:
void SetCallbackMethod(void (*methoPtr)(int))
{
this->m_pPtr = methoPtr;
}
};
The X class will call the callback in the following way:
this->pPtr(10);
Best regards,
J. K.