Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with WM_USER message

Posted on 2000-03-09
2
Medium Priority
?
421 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 200 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

715 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