{"id":29413,"date":"2006-10-12T10:00:06","date_gmt":"2006-10-12T10:00:06","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/10\/12\/how-do-i-prevent-multi-line-edit-controls-from-eating-the-enter-key\/"},"modified":"2006-10-12T10:00:06","modified_gmt":"2006-10-12T10:00:06","slug":"how-do-i-prevent-multi-line-edit-controls-from-eating-the-enter-key","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20061012-06\/?p=29413","title":{"rendered":"How do I prevent multi-line edit controls from eating the Enter key?"},"content":{"rendered":"<p>You might decide to put a multi-line edit control in a dialog box, not because you want the user to input multi-line data, but because it&#8217;s a convenient way to display multi-line text. When you do that, you may notice that the Enter key does not invoke the default dialog button, as you might normally expect. That&#8217;s because the multi-line edit control tells the dialog manager that it wants the Enter key. So how do you tell the multi-line edit control to stop doing that and let the Enter key do its normal thing?\n You already know the answer to this. As we saw quite some time ago, <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/11\/26\/55872.aspx\"> a control responds to the <code>WM_GETDLGCODE<\/code> message to influence the behavior of the dialog manager<\/a>. In this case, the edit control is returning <code>DLGC_WANTMESSAGE<\/code> in response to the keyboard Enter key. What you want to do is prevent this from happening. You want to change the value that the edit control returns to the <code>WM_GETDLGCODE<\/code>.<\/p>\n<p> Since there is no existing window style to specify this behavior, you&#8217;re left with subclassing the control and removing the <code>DLGC_WANTMESSAGE<\/code> code if the message is the Enter key. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might decide to put a multi-line edit control in a dialog box, not because you want the user to input multi-line data, but because it&#8217;s a convenient way to display multi-line text. When you do that, you may notice that the Enter key does not invoke the default dialog button, as you might normally [&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-29413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>You might decide to put a multi-line edit control in a dialog box, not because you want the user to input multi-line data, but because it&#8217;s a convenient way to display multi-line text. When you do that, you may notice that the Enter key does not invoke the default dialog button, as you might normally [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/29413","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=29413"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/29413\/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=29413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=29413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=29413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}