{"id":2463,"date":"2013-12-04T07:00:00","date_gmt":"2013-12-04T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2013\/12\/04\/whats-the-difference-between-the-wparam-of-the-wm_notify-message-and-the-idfrom-in-the-nmhdr-structure\/"},"modified":"2013-12-04T07:00:00","modified_gmt":"2013-12-04T07:00:00","slug":"whats-the-difference-between-the-wparam-of-the-wm_notify-message-and-the-idfrom-in-the-nmhdr-structure","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20131204-00\/?p=2463","title":{"rendered":"What&#039;s the difference between the wParam of the WM_NOTIFY message and the idFrom in the NMHDR structure?"},"content":{"rendered":"<p>The <code>WM_NOTIFY<\/code> message takes the following parameters:<\/p>\n<ul>\n<li><code>wParam<\/code> = identifier of the control sending the message <\/li>\n<li><code>lParam<\/code> = pointer to a <code>NMHDR<\/code> structure     \n<ul>\n<li><code>hwndFrom<\/code> = handle of the control sending the message     <\/li>\n<li><code>idFrom<\/code> = identifier of the control sending the message     <\/li>\n<li><code>code<\/code> = notification code     <\/li>\n<li>other fields depending on the notification code     <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p> Notice that the identifier of the control sending the message appears in two places, once in the <code>wParam<\/code> and again in the <code>idFrom<\/code>. What&#8217;s the difference?\n There is no difference. It&#8217;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 <code>wParam<\/code> because it avoids having to dereference a pointer. You might use the <code>NMHDR<\/code> because that way you have only one thing to pass to your <code>On&shy;Notify<\/code> helper function.\n Whatever floats your boat.<\/p>\n<p> Passing the same information multiple ways is hardly new. The <code>WM_COMMAND<\/code> message also passes redundant information: The control identifier is passed in the low word of the <code>wParam<\/code>, and you can also get it by calling <code>Get&shy;Dlg&shy;Ctrl&shy;ID<\/code> on the window handle passed in the <code>lParam<\/code>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-2463","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=2463"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/2463\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=2463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=2463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=2463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}