CButton sends WM_PARENTNOTIFY message to ancestors but CMFCButton does not. Why?

88 views Asked by At

I am working on a Windows application (built with VS 2019) that relies heavily on MFC functionality. I have a class that is derived from the CWnd class that contains CMFCButton objects (children) which are defined dynamically within the OnCreate handler for the class. I would like for the CMFCButton objects to send the WM_PARENTNOTIFY message to its ancestors, so that they can do some additional handling of the mouse events, but they don't. I tried changing the button type to CButton class and noticed that WM_PARENTNOTIFY was sent as expected. The CMFCButton and CButton were defined/created using all the same parameters. Using CButton seems to solve the issue but I also make use of the extended CMFCButton functionality to control the buttons' appearances.

Can anyone please explain the change in behaviour of these two button types and how I can get CMFCButtons to also send the WM_PARENTNOTIFY message?

0

There are 0 answers