Solved

Problem with WM_USER message

Posted on 2000-03-09
2
411 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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
isEverywhere  challenge 19 85
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 1,247
Problem to open Excel file 15 210
Excel file not created as expected 7 90
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

679 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