The WM_NOTIFY message takes the following parameters:

  • wParam = identifier of the control sending the message
  • lParam = pointer to a NMHDR structure
    • hwndFrom = handle of the control sending the message
    • idFrom = identifier of the control sending the message
    • code = 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 On­Notify 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 Get­Dlg­Ctrl­ID on the window handle passed in the lParam.