{"id":24,"date":"2008-11-19T00:11:14","date_gmt":"2008-11-19T07:11:14","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=20"},"modified":"2008-11-19T00:11:14","modified_gmt":"2008-11-19T07:11:14","slug":"how-to-prevent-cdialog-closing-on-pressing-escape-key","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2008\/11\/19\/how-to-prevent-cdialog-closing-on-pressing-escape-key\/","title":{"rendered":"How to prevent CDialog closing on pressing Escape key"},"content":{"rendered":"<p>MFC CDialog classes have a default behaviour of closing if the user presses Esc key anytime while the dialog has focus. To overcome this behaviour, the Esc key has to be trapped and disabled in the PreTranslateMessage event handler:<\/p>\n<hr \/>\n<div style=\"padding: 2px; background-color: #ffffcc; font-family: Courier\">BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)<br \/>\n{<br \/>\n\/\/ TODO: Add your specialized code here and\/or call the base class<br \/>\n\/\/ disable closing by escape key<br \/>\nif (pMsg->message == WM_KEYDOWN &#038;&#038; pMsg->wParam == VK_ESCAPE)<br \/>\nreturn TRUE;<br \/>\nreturn CDialog::PreTranslateMessage(pMsg);<br \/>\n}<\/div>\n<p><em> <\/em><em> <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>MFC CDialog classes have a default behaviour of closing if the user presses Esc key anytime while the dialog has focus. To overcome this behaviour, <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2008\/11\/19\/how-to-prevent-cdialog-closing-on-pressing-escape-key\/\" title=\"How to prevent CDialog closing on pressing Escape key\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[36,60,71,106,163,257],"class_list":["post-24","post","type-post","status-publish","format-standard","hentry","category-vc","tag-amit","tag-cdialog","tag-close","tag-escape","tag-key","tag-truelogic"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/24","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=24"}],"version-history":[{"count":0,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/24\/revisions"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=24"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=24"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=24"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}