| DOC: C2642 in Message Map Caused by Incorrect PrototypesID: Q85521 
 | 
An attempt to use the message-map mechanism provided by the Microsoft Foundation Classes fails and the compiler generates the following message:
error C2642: cast to pointer to member must be from related pointer to member
The function declarations in the message map do not match the function prototypes declared in the AFXWIN.H file.
Compare the message-handler function prototypes in your application to those in the AFXWIN.H file. Verify that the parameter types and return types match.
Functions that process Windows messages can be defined as member
functions of a derived window class. To use the message-routing
mechanism the Microsoft Foundation Classes provided by the
DECLARE_MESSAGE_MAP, BEGIN_MESSAGE_MAP, and END_MESSAGE_MAP functions,
the function declarations in the derived class must exactly match the
function parameters specified in AFXWIN.H.
The "Microsoft C/C++ Class Libraries Reference" manual and online help
files provided with Microsoft C/C++ version 7.0 and with Microsoft
Visual C++ version 1.0 incorrectly document the prototypes for the
following message-handler functions, as follows:
   afx_msg void OnHScroll(UINT, UINT, CWnd *);
   afx_msg void OnVScroll(UINT, UINT, CWnd *);
   afx_msg int OnCharToItem(UINT, CWnd *, UINT);
   afx_msg int OnVKeyToItem(UINT, CWnd *, UINT); 
   afx_msg void OnHScroll(UINT, UINT, CScrollBar *);
   afx_msg void OnVScroll(UINT, UINT, CScrollBar *);
   afx_msg int OnCharToItem(UINT, CListBox *, UINT);
   afx_msg int OnVKeyToItem(UINT, CListBox *, UINT); 
   afx_msg void OnNcCalcSize(LPRECT); 
   afx_msg void OnNcCalcSize(NCCALCSIZE_PARAMS FAR *); 
   afx_msg void OnWindowPosChanging(WINDOWPOS FAR *);
   afx_msg void OnWindowPosChanged(WINDOWPOS FAR *);
   afx_msg void OnDropFiles(HANDLE);
   afx_msg void OnPaletteIsChanging(CWnd *); Additional query words: 7.00 1.00 2.00 2.10 afx
Keywords          : kb16bitonly 
Version           : 
Platform          : 
Issue type        : Last Reviewed: July 21, 1999