{"id":39503,"date":"2004-05-05T07:00:00","date_gmt":"2004-05-05T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2004\/05\/05\/broadcasting-user-defined-messages\/"},"modified":"2004-05-05T07:00:00","modified_gmt":"2004-05-05T07:00:00","slug":"broadcasting-user-defined-messages","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040505-00\/?p=39503","title":{"rendered":"Broadcasting user-defined messages"},"content":{"rendered":"<p>When you broadcast a message  (via HWND_BROADCAST)  remember that the message you broadcast must have global meaning.  <a href=\"http:\/\/weblogs.asp.net\/oldnewthing\/archive\/2003\/12\/02\/55914.aspx\">  I discussed earlier what the various message ranges mean<\/a>.  Notice that only the system-defined range (0..WM_USER-1) and  the registered message range (MAXINTATOM .. MAXWORD) have global  meaning.  The other two ranges have class-specifc or  application-specific meanings.\n  In other words, you can&#8217;t broadcast a message in the WM_USER range  since that message has a different meaning for each window class.  Similarly, a message in the WM_APP range has a different meaning  for each application.\n  We ran into this problem in Windows&nbsp;95.  There were programs that decided to broadcast  private messages like WM_USER+0x0100,  intending them to be delivered to  other instances of that program.  Of course, when those messages reached some other windows,  they interpreted WM_USER+0x0100 as some other private message  and either acted funny or crashed.\n  On the other hand, the programs really wanted the message to  reach the windows of other copies of itself, so we couldn&#8217;t  just block the broadcast of the programs would stop working.  Progams were relying on the system not trying to stop them from  crashing other programs!\n  The solution was to split the difference.  If you broadcast a message that was not safe to broadcast,  Windows 95 would send it only to old-style programs.  New-style programs (marked as version 4.0 or higher) would not  receive the messages.\n  That way, old programs continued to affect each other as they  always did, but new programs followed the new rules.<\/p>\n<p>  Moral of the story:  When you broadcast a message, make sure it&#8217;s one that every  receiving window will be able to handle.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you broadcast a message (via HWND_BROADCAST) remember that the message you broadcast must have global meaning. I discussed earlier what the various message ranges mean. Notice that only the system-defined range (0..WM_USER-1) and the registered message range (MAXINTATOM .. MAXWORD) have global meaning. The other two ranges have class-specifc or application-specific meanings. In other [&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":[2],"class_list":["post-39503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>When you broadcast a message (via HWND_BROADCAST) remember that the message you broadcast must have global meaning. I discussed earlier what the various message ranges mean. Notice that only the system-defined range (0..WM_USER-1) and the registered message range (MAXINTATOM .. MAXWORD) have global meaning. The other two ranges have class-specifc or application-specific meanings. In other [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/39503","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=39503"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/39503\/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=39503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=39503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=39503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}