Adding Basic shell auto-complete feature for your edit box or combo box

November 3, 2007

Just now I read about adding Auto complete feature to Edit box using Shell API.It’s very easy thing, you can touch up your application with Auto complete feature in 1-2 steps.1. Call CoInitiailize(NULL) when application initializes2. When the dialog initializes put the code.HRESULT hResult = SHAutoComplete(m_Edit.m_hWnd, SHACF_FILESYSTEM);The above code would be enough for a list box. So what you need in additional to put Auto complete feature for a combo box.Either your combo box is having of extended type (CComboboxEx) and use SendMessage function with as parameter to retrieve the handle of Edit control and use the edit control handle in SHAutoComplete function.For the normal combo box, you can use the following tweakHWND hWnd = ::FindWindowEx(m_Combo.m_hWnd,NULL,”Edit”,NULL);SHAutoComplete(hWnd, SHACF_URLHISTORY);Auto completeSHAutoComplete function will give a minimal but enough auto completion mechanism available in Shell. You can checkout a variety of options from MSDN documentation.You can also check Using Autocomplete article from MSDN. It will give more information on using IAutoComplete Object.