{"id":35193,"date":"2005-06-27T09:00:00","date_gmt":"2005-06-27T09:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/06\/27\/why-are-there-broadcast-based-mechanisms-in-windows\/"},"modified":"2005-06-27T09:00:00","modified_gmt":"2005-06-27T09:00:00","slug":"why-are-there-broadcast-based-mechanisms-in-windows","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050627-00\/?p=35193","title":{"rendered":"Why are there broadcast-based mechanisms in Windows?"},"content":{"rendered":"<p>Many Windows information mechanisms are based on message broadcasts, among them <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/winui\/winui\/windowsuserinterface\/dataexchange\/dynamicdataexchange.asp\"> DDE<\/a>, <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/gdi\/fontext_1nol.asp\"> WM_FONTCHANGE<\/a>, and changes in <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/sysinfo\/base\/wm_wininichange.asp\"> system settings<\/a>. Why do these mechanisms use broadcasts, when we know that broadcasts can result in the system grinding to a halt due to windows that have stopped processing messages?\n Because in 16-bit Windows, you didn&#8217;t have this problem.\n Recall that 16-bit Windows was co-operatively multi-tasking. When a program received control of the CPU, it could do anything it wanted, knowing that no other programs could run until it explicitly yielded control by calling a function such as <code>GetMessage<\/code> or <code>PeekMessage<\/code>. The downside of this, of course, was that a single hung program caused the entire system to hang, because it wasn&#8217;t releasing the CPU.\n The upside, however, was that if your program was running, then you knew, <i>a priori<\/i>, that there were no hung programs in the system. How do you know that? Because if there were a hung program, <strong>it would be running and not you<\/strong>.\n If there&#8217;s only one thing, and you have it, then you know that nobody else is hogging it.\n Therefore, broadcasting messages was completely safe in 16-bit Windows. You didn&#8217;t have to worry about non-responsive programs because you had proof that there weren&#8217;t any.\n Of course, when the switch to pre-emptive multi-tasking occurred, this assumption no longer applied, but by then it was too late. The broadcast-based model was already in use, and consequently had to be preserved for compatibility reasons. (It would be bad if, for example, Lotus&nbsp;1-2-3 stopped working on Windows&nbsp;NT because DDE broadcasts were no longer supported. If the Windows&nbsp;NT team had tried that gambit, nobody would have upgraded and Windows&nbsp;NT wouldn&#8217;t have <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2005\/06\/23\/431876.aspx\"> survived to make a second version<\/a>.)<\/p>\n<p> On the other hand, given the risks involved in DDE broadcasts, you probably would be better off designing <strong>your<\/strong> program to not use dynamic data exchange as a data communication mechanism, thereby avoiding the pitfall of message broadcasts. No point contributing to the problem. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Many Windows information mechanisms are based on message broadcasts, among them DDE, WM_FONTCHANGE, and changes in system settings. Why do these mechanisms use broadcasts, when we know that broadcasts can result in the system grinding to a halt due to windows that have stopped processing messages? Because in 16-bit Windows, you didn&#8217;t have this problem. [&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-35193","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Many Windows information mechanisms are based on message broadcasts, among them DDE, WM_FONTCHANGE, and changes in system settings. Why do these mechanisms use broadcasts, when we know that broadcasts can result in the system grinding to a halt due to windows that have stopped processing messages? Because in 16-bit Windows, you didn&#8217;t have this problem. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/35193","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=35193"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/35193\/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=35193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=35193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=35193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}