Is WM_NOTIFY sent to a subclassed control?

Started by
1 comment, last by Jacob Jingle 13 years, 11 months ago
Is WM_NOTIFY sent to a subclassed control(List-view)? Specifically are LVN_GETDISPINFO, NM_DBLCLK, NM_RCLICK sent to the control? If not, if it is only sent to the parent, than what is the best way of redirecting the messages to the control? Thx ahead of time.
Advertisement
WM_NOTIFY is always sent to the parent of the child window to which it refers. The Win32 model, basically, is that parents own children and it is the responsibility of owners to handle events. So if you want your subclassed listview to handle its own notifications you have to explicitly forward the relevant messages using SendMessage() in the WndProc of the parent.

Another option would just be to make functions that do the event handling of your custom control given an HWND, sort of like fake member fuctions, and then call those functions from the parent window on notifications.

You could also always create your subclassed listview in a custom dummy child window sized exactly the same size as its child listview that does nothing but handle the notifications, etc., but I don't recommend doing this.
Quote:Original post by jwezorek
WM_NOTIFY is always sent to the parent of the child window to which it refers. The Win32 model, basically, is that parents own children and it is the responsibility of owners to handle events. So if you want your subclassed listview to handle its own notifications you have to explicitly forward the relevant messages using SendMessage() in the WndProc of the parent.

Another option would just be to make functions that do the event handling of your custom control given an HWND, sort of like fake member fuctions, and then call those functions from the parent window on notifications.

You could also always create your subclassed listview in a custom dummy child window sized exactly the same size as its child listview that does nothing but handle the notifications, etc., but I don't recommend doing this.

Go second option. Thx for your help.

This topic is closed to new replies.

Advertisement