0

What code is needed in the message map for Windows messages?

The code calling the function:

SendMessage(GRID_WM_UPDATECELL,(WPARAM)1,(LPARAM)&sDisp);

The function:

LRESULT CNJAGridCtrl::OnUpdateCell(WPARAM wParam, LPARAM lParam)
{
}
Jak
  • 471
  • 5
  • 20
  • How does the declaration of OnUpdateCell look like? How does the message map entry look like? – Werner Henze Jun 30 '14 at 14:53
  • It is not caused by the casts. You get this diagnostic when a function declaration doesn't match the function implementation. You gave us no hint at all what function that might be. The debugger tells you. – Hans Passant Jun 30 '14 at 15:34
  • @WernerHenze I added the declaration afx_msg LRESULT OnUpdateCell(WPARAM wParam, LPARAM, lParam); but I also have LRESULT OnUpdateCell(WPARAM wParam, LPARAM lParam); and virtual void UpdateCell(BOOL bAdd, NJACELLINFO sDisp); in the header file. Is this correct? – Jak Jul 01 '14 at 11:38
  • Use the Call Stack debugger window. It is the function call before the statement where it stopped that is borken. Could be buried inside a macro, MFC likes them too much. – Hans Passant Jul 02 '14 at 10:00

1 Answers1

1

The message map line should be

ON_MESSAGE(GRID_WM_UPDATECELL, OnUpdateCell) 

and the function signature should be

LRESULT CNJAGridCtrl::OnUpdateCell(WPARAM wParam, LPARAM lParam);
ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • What are you talking about? There is no virtual function here. – ScottMcP-MVP Jul 02 '14 at 13:34
  • Instead of using afx_msg the code is using virtual functions and I'm wondering if that might be part of the problem. It might also be something similar to this [link](http://stackoverflow.com/questions/24179534/message-map-mfc-with-multiple-inheritance-how-to-avoid-warning-c4407-and-runtim) – Jak Jul 02 '14 at 13:48