{"id":630,"date":"2010-05-24T12:37:45","date_gmt":"2010-05-24T00:37:45","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=630"},"modified":"2010-05-24T12:38:43","modified_gmt":"2010-05-24T00:38:43","slug":"shautocomplete-calling-once-calling-twice","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/630\/","title":{"rendered":"SHAutoComplete: Calling Once, Calling Twice&#8230;"},"content":{"rendered":"<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">&lt; 1<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>The usually exhaustively complete Raymond Chen over-looked a crucial factor in his most recent posting on his excellent\u00a0<a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/\"><em>Old New Thing Blog<\/em><\/a> regarding\u00a0<strong>SHAutoComplete<\/strong>.<\/p>\n<p><img decoding=\"async\" style=\"border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-top-style: dotted; border-top-color: #cccccc; display: block; width: 846px; height: 12px; margin-top: 15px; background-image: url(https:\/\/www.deltics.co.nz\/blog\/wp-includes\/js\/tinymce\/plugins\/wordpress\/img\/more_bug.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffff; background-position: 100% 0%; background-repeat: no-repeat no-repeat;\" title=\"More...\" src=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-includes\/js\/tinymce\/plugins\/wordpress\/img\/trans.gif?w=640&#038;ssl=1\" alt=\"\" data-recalc-dims=\"1\" \/>In his post he discusses a technique for disabling auto-complete in a common dialog, but along the way discusses why calling\u00a0<strong>SHAutoComplete<\/strong> twice cannot be used to remove flags previously applied. \u00a0As I say, Raymond normally is very precise and exhaustive in his coverage, \u00a0often pre-empting &#8220;nit pickers&#8221; by calling out in advance anything and everything wrong with a question or with approaches that are implied in the question (or in his answer).<\/p>\n<p>In this case, I would have expected him to draw particular attention to the warning in the\u00a0<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb759862(v=VS.85).aspx\">MSDN docs for SHAutoComplete<\/a>:<\/p>\n<blockquote><p><strong>&#8220;SHAutoComplete<\/strong> should not be called more than once with the same\u00a0<strong>HWND<\/strong>. Doing so results in a memory leak.&#8221;<\/p><\/blockquote>\n<p>But far from it &#8211; he actually\u00a0<span style=\"text-decoration: underline;\">advocates<\/span> calling\u00a0<strong>SHAutoComplete<\/strong> a second time to modify flags if needed!<\/p>\n<p>Sadly, comments are currently disabled on\u00a0<em>The Old New Thing<\/em> due to an extraordinarily lengthy upgrade process being carried out on the underlying blogging system, so I was unable to draw attention to this (and no doubt earn myself a\u00a0<strong>Nit Picker<\/strong> &#8220;badge&#8221; in the process), but in this case I think it&#8217;s worth highlighting.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">&lt; 1<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span> The usually exhaustively complete Raymond Chen over-looked a crucial factor in his most recent posting on his excellent\u00a0Old New Thing Blog regarding\u00a0SHAutoComplete. In his post he discusses a technique for disabling auto-complete in a common dialog, but along the way discusses why calling\u00a0SHAutoComplete twice cannot be used to remove flags previously applied. \u00a0As I say, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[4,1],"tags":[108,292,106,107,105,104],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-aa","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":563,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/563\/","url_meta":{"origin":630,"position":0},"title":"Delphi Unicode = Wide-ANSI","date":"26 Sep 2009","format":false,"excerpt":"Be careful what you wish for. A lot of people were overjoyed to hear that Unicode support was coming to Delphi. Some were skeptical of the chosen implementation approach however, it all seemed just a little bit too easy. I was one, and sadly it seems I was right. I've\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":653,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/653\/","url_meta":{"origin":630,"position":1},"title":"RAD Studio &#8220;XE&#8221;","date":"11 Aug 2010","format":false,"excerpt":"News is starting to come out about the upcoming release of Delphi, RAD Studio XE. So what can we expect? Well, based on what has been revealed so far, anyone thinking that the time that has passed since we were supposed to have received 64-bit support has been well spent\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1930,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/1930\/","url_meta":{"origin":630,"position":2},"title":"VCL Threading &#8211; Indeterminate Lifetimes","date":"18 Oct 2013","format":false,"excerpt":"Sometimes when you launch a thread you don't know when it will complete whatever processing it is tasked with. Sometimes you do. Sometimes it may never complete and will require that you expressly terminate it. Usually any given thread will have a lifecycle that is at least consistently one or\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1833,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/1833\/","url_meta":{"origin":630,"position":3},"title":"Importing an Android Class For Use in Delphi","date":"03 Oct 2013","format":false,"excerpt":"In a previous post I noted the absence of the BatteryManager class in the AndroidAPI.JNI units. This class contains some constants useful when reading battery information. I showed how to use a suitably massaged literal in place of these missing constants, but in response to observations from Paul and Brian\u2026","rel":"","context":"In &quot;Android&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1925,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/1925\/","url_meta":{"origin":630,"position":4},"title":"VCL Threading &#8211; Synchronization","date":"16 Oct 2013","format":false,"excerpt":"Although I am using Oxygene a lot these days, Delphi remains my tool of choice for Win32 (and x64) development, together with the VCL. Hence this post. A long time ago, in a galaxy far far away, Delphi was a Windows only development tool. 16 was the number of the\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1356,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/1356\/","url_meta":{"origin":630,"position":5},"title":"Hint: Using a Wrong to Make a Wrong Wrong Right","date":"15 Feb 2013","format":false,"excerpt":"Yesterday I found myself having to write some code that would never be used in order to co-erce the compiler into not complaining that something would not be used when in fact it was. Something I have learned over the years is that hints and warnings are useful guides to\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/630"}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=630"}],"version-history":[{"count":2,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/630\/revisions"}],"predecessor-version":[{"id":632,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/630\/revisions\/632"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=630"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=630"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=630"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}