{"id":112691,"date":"2026-09-11T07:00:00","date_gmt":"2026-09-11T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=112691"},"modified":"2026-09-14T07:14:47","modified_gmt":"2026-09-14T14:14:47","slug":"20260911-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20260911-00\/?p=112691","title":{"rendered":"How can I remove the Close button from my window caption?"},"content":{"rendered":"<p>Occasionally, somebody wants to create a window without a Close button.<\/p>\n<p>The only way to get rid of the Close button is not to have a System menu at all: Remove the <code>WS_<wbr \/>SYS\u00adMENU<\/code> style from the window. But that also gets rid of the Minimize and Maximize buttons, so it&#8217;s kind of drastic.<\/p>\n<p>If you want a System menu, or if you want Minimize and Maximize buttons, you can at least disable the Close button by disabling the <code>SC_CLOSE<\/code> menu item.<\/p>\n<pre>HMENU menu = GetSystemMenu(hwnd, FALSE);\r\nEnableMenuItem(menu, SC_CLOSE, MF_DISABLED);\r\n<\/pre>\n<p>Of course, you could use the nuclear option and implement your own custom title bar. Then you can do whatever you want. But most people are probably not willing to take things to such an extreme.<\/p>\n<p>But really, try not to hide or disable the Close the button at all. End users don&#8217;t like it. It makes them feel trapped.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not through normal means.<\/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":[],"class_list":["post-112691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing"],"acf":[],"blog_post_summary":"<p>Not through normal means.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112691","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=112691"}],"version-history":[{"count":1,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112691\/revisions"}],"predecessor-version":[{"id":112695,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/112691\/revisions\/112695"}],"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=112691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=112691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=112691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}