I’ve got some control like CtrlTree on CMyDialog.
I want to handle messages like ON_WM_LBUTTONDOWN() from CTreeCtrl in the CMyDialog class.
Is there any way in MFC to redirect message stream to parent?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The simplest way to redirect your messages is just sending a custom (
WM_USER + xxx) message from your control’sON_WM_LBUTTONDOWNhandler to the parent class.Place parent’s
WM_LBUTTONDOWNhandler code in a separate method and call this method directly.Something like that (pseudo code), presuming that your existing code sits in
HandleTreeCtrlLBDown()