SHAutoComplete: Calling Once, Calling Twice…
[Estimated Reading Time: < 1 minute] The usually exhaustively complete Raymond Chen over-looked a crucial factor in his most recent posting on his excellent Old New Thing Blog regarding SHAutoComplete. In his post he discusses a technique for disabling auto-complete in a common dialog, but along the way discusses why calling SHAutoComplete twice cannot be used to remove flags previously applied. As I say, Raymond normally is very precise and exhaustive in his coverage, often pre-empting “nit pickers” 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). In this case, I would have expected him to draw particular attention to the warning in the MSDN docs for SHAutoComplete: “SHAutoComplete should not be called more than once with the same HWND. Doing so results in a memory leak.” But far from it – he actually advocates calling SHAutoComplete a second time to modify flags if needed! Sadly, comments are currently disabled on The Old New Thing 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 Nit Picker “badge” in the process), but in this case I think it’s worth Read More…