Custom CDateTimeCtrl notification messages

I wrote class CMyTimePicker : public CDateTimeCtrl {...}
It has a handler for DateTime Change message:
void CMyTimePicker::OnDatetimechange(NMHDR* pNMHDR, LRESULT* pResult)
   //do smth
   *pResult = 0;
I also need to notify parent dialog about this message. How to do this?
Regular handler in parent dialog does not resond if I overrride it in my derived class:
void CMyDlg::OnDatetimechangeDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
   // Does not come here anymore      
   *pResult = 0;
Thank you
Who is Participating?
AlexFMConnect With a Mentor Commented:
See TN062: Message Reflection for Windows Controls

If, in your parent window class, you supply a handler for a specific WM_NOTIFY message or a range of WM_NOTIFY messages, your handler will be called only if the child control sending those messages does not have a reflected message handler through ON_NOTIFY_REFLECT().

This is what happens in your project.
And this is what you need:

If you use ON_NOTIFY_REFLECT_EX() in your message map, your message handler may or may not allow the parent window to handle the message. If the handler returns TRUE, the message will be handled by the parent as well, while a call that returns FALSE does not allow the parent to handle it. Note that the reflected message is handled before the notification message.

Use this:
ON_NOTIFY_REFLECT_EX( wNotifyCode, memberFxn )

afx_msg BOOL memberFxn ( NMHDR * pNotifyStruct, LRESULT* result );
stkashAuthor Commented:
very strange but it works in opposite way:
if the memberFxn returns FALSE - parent receives the message, if TRUE - it does not receive it.
Yes, this is default behaviour. Possibly error in the Technical Note.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.