cast to pointer to member must be from related pointer to member
A pointer to a member of one class was cast to a pointer to a member of another class (or structure) that was not a base class or derived class (of the first class).
In MFC applications this error may be caused by a mismatch between the function declarations in the message map and the function prototypes declared in the AFXWIN.H file. Check your message map functions against the prototypes in AFXWIN.H.
The following is an example of this error:
class B
{
public:
int b;
};
class C {};
class D : public B
{
public:
int d;
};
int C::* cpb = (int C::*)&B::b; // error
int D::* dpb = (int D::*)&B::b; // OK, B is a base class of D
int B::* bpd = (int B::*)&D::d; // OK