C language > Windows questions

Sub-classing question

<< < (2/2)

frankie:

--- Quote from: aj666 on June 28, 2020, 04:41:06 AM ---Thank you again for your help Frankie. Very enlightening. In what I have read about sub-classing, child window messages were sent to the parent window without the need for re-direction and the child window messages were then processed in the parent window procedure. I have been unable to add text to a sub-classed child window or re-size a sub-classed child window from within the child window's own procedure so I accepted what I had read.

--- End quote ---
I'm glad that you accepted the way things has been designated. So you can start looking on advanced topics: notifications.
The parent of a child window could be notified of messages sent to the child through the WM_PARENTNOTIFY message.
This could be helpful, but it's also very tricky. Be careful about which window is parent of what child, and that the notification hasn't been disabled (WS_EX_NOPARENTNOTIFY extended window style set by default in dialog boxes). If you need to to be notified only in the direct parent window, and the notification is in the list of those supported by WM_PARENTNOTIFY message, you can avoid subclassing in theory.
As a hint early versions of MFC subclassed all windows notifying ascending way each parent up to the one that was in need to handle the message...  ::)

Navigation

[0] Message Index

[*] Previous page

Go to full version