{"id":25183,"date":"2007-09-11T10:00:00","date_gmt":"2007-09-11T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2007\/09\/11\/whats-the-difference-between-em_undo-and-wm_undo\/"},"modified":"2007-09-11T10:00:00","modified_gmt":"2007-09-11T10:00:00","slug":"whats-the-difference-between-em_undo-and-wm_undo","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20070911-00\/?p=25183","title":{"rendered":"What&#039;s the difference between EM_UNDO and WM_UNDO?"},"content":{"rendered":"<p><a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#437591\"> Daniel Chait wonders why we have both <code>EM_UNDO<\/code> and <code>WM_UNDO<\/code><\/a>. You know, I wonder the same thing. But I&#8217;m going to make an educated guess.\n Actually, most of what I write is just a lot of educated guessing. Like my explanation of <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/09\/04\/54794.aspx\"> why <code>GetWindowText<\/code> has such complicated rules<\/a>? A guess. <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/10\/08\/55239.aspx\"> Why address space granularity is 64KB<\/a>? A guess. <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2007\/09\/10\/4849069.aspx\"> Why most <code>EM_*<\/code> messages are in the system message range<\/a>? A guess. Mind you, it&#8217;s logical guesswork, usually strongly guided by the principle of &#8220;Imagine if this were possible.&#8221;\n Today&#8217;s guesswork: The history of <code>EM_UNDO<\/code> and <code>WM_UNDO<\/code>.\n It seems obvious that <code>EM_UNDO<\/code> came first. After all, why would there need to be a <code>EM_UNDO<\/code> message if a <code>WM_UNDO<\/code> already existed?\n At some point, somebody decided, &#8220;Hey, this sounds like something that people might want to do more generally.&#8221; New messages <code>WM_CUT<\/code>, <code>WM_COPY<\/code>, <code>WM_PASTE<\/code>, <code>WM_CLEAR<\/code>, and <code>WM_UNDO<\/code> were added, and the first control to implement them was the edit control.\n Therefore, the answer to the question is that for edit controls, the difference is that there is no difference.<\/p>\n<p> The window manager does not provide a default implementation for any of these new messages. (Obviously, because the window manager is not psychic.) If you want your control to support those operations, you&#8217;ll have to respond to the messages yourself. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Daniel Chait wonders why we have both EM_UNDO and WM_UNDO. You know, I wonder the same thing. But I&#8217;m going to make an educated guess. Actually, most of what I write is just a lot of educated guessing. Like my explanation of why GetWindowText has such complicated rules? A guess. Why address space granularity is [&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-25183","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Daniel Chait wonders why we have both EM_UNDO and WM_UNDO. You know, I wonder the same thing. But I&#8217;m going to make an educated guess. Actually, most of what I write is just a lot of educated guessing. Like my explanation of why GetWindowText has such complicated rules? A guess. Why address space granularity is [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25183","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=25183"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/25183\/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=25183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=25183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=25183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}