Sign in to follow this  
Jacob Jingle

Is WM_NOTIFY sent to a subclassed control?

Recommended Posts

Jacob Jingle    226
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.

Share this post


Link to post
Share on other sites
jwezorek    2663
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.

Share this post


Link to post
Share on other sites
Jacob Jingle    226
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this