The WM_NOTIFY
message takes the following parameters:
wParam
= identifier of the control sending the messagelParam
= pointer to aNMHDR
structurehwndFrom
= handle of the control sending the messageidFrom
= identifier of the control sending the messagecode
= notification code- other fields depending on the notification code
Notice that the identifier of the control sending the message appears in two places, once in the wParam
and again in the idFrom
. What’s the difference?
There is no difference. It’s just a convenience. The same value is passed in both places, and you can check whichever one is easier for you. You might use the wParam
because it avoids having to dereference a pointer. You might use the NMHDR
because that way you have only one thing to pass to your OnNotify
helper function.
Whatever floats your boat.
Passing the same information multiple ways is hardly new. The WM_COMMAND
message also passes redundant information: The control identifier is passed in the low word of the wParam
, and you can also get it by calling GetDlgCtrlID
on the window handle passed in the lParam
.
0 comments