Link to home
Start Free TrialLog in
Avatar of mahno
mahno

asked on

Problem with WM_USER message

Hi,

I have a problem with WM_USER message. I have a class CRichListBox, child from CListBox. I overriden method
OnLButtonDown(UINT nFlags, CPoint point) this way:

//RichListBox.h:
#define WM_USER_RICHLISTBOX_LINK      WM_USER+0x1235

//RichListBox.cpp:

void CRichListBox::OnLButtonDown(UINT nFlags, CPoint point) {      
  //do something...
 
  //Send WM_USER message to parent
  GetParent()->SendMessage(WM_USER_RICHLISTBOX_LINK, 0, 0);
}


Dialog class:

//C_MFC_TESTDlg.h:

class C_MFC_TESTDlg : public CDialog
{
//...
  //{{AFX_MSG(C_MFC_TESTDlg)
  //...
  afx_msg void OnLink();
  //}}AFX_MSG
  DECLARE_MESSAGE_MAP()
//...
};


//C_MFC_TESTDlg.cpp:
//...
BEGIN_MESSAGE_MAP(C_MFC_TESTDlg, CDialog)
  //{{AFX_MSG_MAP(C_MFC_TESTDlg)
  //...
  ON_MESSAGE(WM_USER_RICHLISTBOX_LINK, OnLink)
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()

//...

void C_MFC_TESTDlg::OnLink() {
  //...
}

This construction works fine in Debug version (Debug configuration). But in Release vesion I get "This program has performad an illegal operation..." e.g. program crashed.

Someone can tell me why this happens? May be I need to delete message after processing?

regards,
 mahno
ASKER CERTIFIED SOLUTION
Avatar of Vinayak Kumbar
Vinayak Kumbar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mahno
mahno

ASKER

Thanx