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::OnLButtonDow n(UINT nFlags, CPoint point) {
//do something...
//Send WM_USER message to parent
GetParent()->SendMessage(W M_USER_RIC HLISTBOX_L INK, 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_TE STDlg, CDialog)
//{{AFX_MSG_MAP(C_MFC_TEST Dlg)
//...
ON_MESSAGE(WM_USER_RICHLIS TBOX_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
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::OnLButtonDow
//do something...
//Send WM_USER message to parent
GetParent()->SendMessage(W
}
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_TE
//{{AFX_MSG_MAP(C_MFC_TEST
//...
ON_MESSAGE(WM_USER_RICHLIS
//}}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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER