{"id":31983,"date":"2006-03-09T10:00:09","date_gmt":"2006-03-09T10:00:09","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2006\/03\/09\/if-you-ask-for-a-window-caption-you-also-get-a-border\/"},"modified":"2006-03-09T10:00:09","modified_gmt":"2006-03-09T10:00:09","slug":"if-you-ask-for-a-window-caption-you-also-get-a-border","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20060309-09\/?p=31983","title":{"rendered":"If you ask for a window caption, you also get a border"},"content":{"rendered":"<p>\nSome people may have noticed that the <code>WS_CAPTION<\/code>\nis defined as the combination of <code>WS_BORDER<\/code>\nand <code>WS_DLGFRAME<\/code>:\n<\/p>\n<pre>\n#define WS_CAPTION          0x00C00000L     \/* WS_BORDER | WS_DLGFRAME  *\/\n#define WS_BORDER           0x00800000L\n#define WS_DLGFRAME         0x00400000L\n<\/pre>\n<p>\nSince <code>WS_CAPTION<\/code> includes <code>WS_BORDER<\/code>,\nit is impossible to get a caption without a border.\n<\/p>\n<p>\nSometimes people don&#8217;t quite get this and keep asking the question\nover and over again, and I have to keep trying to explain the\nlaws of logic in different ways until one of them finally sinks in.\n<\/p>\n<p>\n&#8220;I noticed that if I set the <code>WS_CAPTION<\/code> style,\nI get a window with a title bar and a border.\nI don&#8217;t want the border.\nHow do I get rid of the border?\nI tried all sorts of combinations of window styles but none of them\nget me what I want.&#8221;\n<\/p>\n<p>\n&#8220;If you look at the definition, <code>WS_CAPTION<\/code> includes\n<code>WS_BORDER<\/code>, so you can&#8217;t get a caption without a border.&#8221;\n<\/p>\n<p>\n&#8220;But I see other controls that don&#8217;t have a border.\nStatic controls on a dialog box, for example, don&#8217;t have a border,\nso obviously it&#8217;s possible to remove the border.\nHow do I do that?&#8221;\n<\/p>\n<p>\n&#8220;They don&#8217;t have borders, but then again, they don&#8217;t have captions either.\nCaption implies border.&#8221;\n<\/p>\n<p>\n&#8220;But I want a window with a caption and no border.\nWhat window styles do I need to use to get that?\nDo I have to implement it some other way?&#8221;\n<\/p>\n<p>\n&#8220;Caption implies border.\nContrapositive: No border implies no caption.\nIf you don&#8217;t like that, you&#8217;ll have to take it up with\n<a HREF=\"http:\/\/plato.stanford.edu\/entries\/principia-mathematica\/\">\nRussell and Whitehead<\/a>.&#8221;\n<\/p>\n<p>\nOf course, you can just choose to leave the system entirely\nand use none of the styles at all and just paint a custom caption.\nWhat you get isn&#8217;t a real caption, though with enough work you\ncan make it look and act like one.\nOr at least, make it look and act like one up to the present time.\nIf you have the power of clairvoyance, you might be able to\nmake it look and act like a caption in future versions of the\noperating system,\nbut I suspect your psychic powers are not quite powerful enough\nto pull that off.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some people may have noticed that the WS_CAPTION is defined as the combination of WS_BORDER and WS_DLGFRAME: #define WS_CAPTION 0x00C00000L \/* WS_BORDER | WS_DLGFRAME *\/ #define WS_BORDER 0x00800000L #define WS_DLGFRAME 0x00400000L Since WS_CAPTION includes WS_BORDER, it is impossible to get a caption without a border. Sometimes people don&#8217;t quite get this and keep asking the [&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-31983","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Some people may have noticed that the WS_CAPTION is defined as the combination of WS_BORDER and WS_DLGFRAME: #define WS_CAPTION 0x00C00000L \/* WS_BORDER | WS_DLGFRAME *\/ #define WS_BORDER 0x00800000L #define WS_DLGFRAME 0x00400000L Since WS_CAPTION includes WS_BORDER, it is impossible to get a caption without a border. Sometimes people don&#8217;t quite get this and keep asking the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31983","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=31983"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/31983\/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=31983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=31983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=31983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}