{"id":750,"date":"2010-07-01T18:00:25","date_gmt":"2010-07-01T18:00:25","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=750"},"modified":"2010-07-01T18:00:25","modified_gmt":"2010-07-01T18:00:25","slug":"crappy-windows-code","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2010\/07\/01\/crappy-windows-code\/","title":{"rendered":"Crappy windows code"},"content":{"rendered":"<p>Soo&#8230; some people have a bug in <a href=\"http:\/\/www.gratuitousspacebattles.com\">GSB<\/a> where in fullscreen mode, the titlebar of the windows &#8216;window&#8217; is still there, but invisible, meaning you can accidentally hit the close or miniomize buttons, or worse-still, double click and then &#8216;maximise&#8217; the already fullscreen window.<\/p>\n<p>I have encountered this a few times in <a href=\"http:\/\/www.gratuitousspacebattles.com\">GSB<\/a> myself. but cannot reproduce it right now. It&#8217;s certainly not reliable. And it&#8217;s annoying. I would love to fix it. I&#8217;m pretty sure its something to do with the windows code that selects either a windows style or windows class.<\/p>\n<p>currently I use:<\/p>\n<pre>wcex.style\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 =\u00a0\u00a0\u00a0 CS_CLASSDC | CS_DBLCLKS;<\/pre>\n<p>and<\/p>\n<pre>HWND gWnd = CreateWindow(appname,appname,\r\n WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,\r\n 0,0, width, height, GetDesktopWindow(), NULL, hInstance, NULL);<\/pre>\n<p>Both chunks of code I haven&#8217;t changed in ages. I suspect the code is wrong, but am finding it impossible to find what is &#8216;correct&#8217;. Looking at the directx samples makes me want to cry. In amongst 500,000 pages of incredibly convoluted, confusing, totally over-engineered MFC style bullshit that they call &#8216;DXUT&#8217;, there is a hint that microsoft themselves use just CS_DBLCLKS and WS_OVERLAPPED. The thing is WHY? There is no documentation. In the old days, directx5 used to tell us we need to use WS_TOPMOST or somesuch.<\/p>\n<p>You would imagine that as 95% of people using directx write games, and 90% of them want to, at some point, run fullscreen, that the directx docs would have a line saying &#8220;for fullscreen apps, you need to select these options for your window&#8221;. No such clues have emerged though.\u00a0 Another evenings trolling through coding forums no doubt&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Soo&#8230; some people have a bug in GSB where in fullscreen mode, the titlebar of the windows &#8216;window&#8217; is still there, but invisible, meaning you can accidentally hit the close or miniomize buttons, or worse-still, double click and then &#8216;maximise&#8217; the already fullscreen window. I have encountered this a few times in GSB myself. but<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; Crappy windows code<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2010\/07\/01\/crappy-windows-code\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,4],"tags":[],"class_list":["post-750","post","type-post","status-publish","format-standard","hentry","category-gratuitous-space-battles","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=750"}],"version-history":[{"count":2,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/750\/revisions"}],"predecessor-version":[{"id":752,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/750\/revisions\/752"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}