Solved

Problem with WM_USER message

Posted on 2000-03-09
2
416 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:mahno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
VinExpert earned 50 total points
ID: 2600118
Hi,

Change Ur function declaration to

afx_msg void OnLink(WPARAM wParam, LPARAM lParam);

And function as
void C_MFC_TESTDlg::OnLink(WPARAM wParam, LPARAM lParam)
{
            //...
}

Hope this helps.

VinExpert
0
 
LVL 1

Author Comment

by:mahno
ID: 2600359
Thanx
0

Featured Post

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question