[BROWSEUI]
authorDavid Quintana <gigaherz@gmail.com>
Thu, 19 Jun 2014 23:23:04 +0000 (23:23 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Thu, 19 Jun 2014 23:23:04 +0000 (23:23 +0000)
* Process ParseNow on the CBEN_ENDEDIT notification.
* Call SHAutoComplete to ask the edit control to have autocomplete functionality. I need to figure out the flag or whatever is needed to make it show "Search 'string'" when entering something that's not a valid path.

svn path=/branches/shell-experiments/; revision=63621

dll/win32/browseui/addressband.cpp
dll/win32/browseui/addresseditbox.cpp

index 4812ab8..8e1f92e 100644 (file)
@@ -347,6 +347,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
     CComPtr<IWinEventHandler>               winEventHandler;
     HRESULT                                 hResult;
 
+    *theResult = 0;
+
     switch (uMsg)
     {
         case WM_WININICHANGE:
@@ -544,7 +546,6 @@ LRESULT CAddressBand::OnNotifyClick(WPARAM wParam, NMHDR *notifyHeader, BOOL &bH
 {
     if (notifyHeader->hwndFrom == fGoButton)
     {
-        fAddressEditBox->ParseNow(0);
         fAddressEditBox->Execute(0);
     }
     return 0;
index 2ff05ce..78ff858 100644 (file)
@@ -74,6 +74,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Init(HWND comboboxEx, HWND editContro
     fEditWindow.SubclassWindow(editControl);
     fSite = param18;
 
+    SHAutoComplete(fEditWindow.m_hWnd, SHACF_FILESYSTEM | SHACF_URLALL | SHACF_USETAB);
+
     // take advice to watch events
     HRESULT hResult = IUnknown_QueryService(param18, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
     if (SUCCEEDED(hResult))
@@ -98,8 +100,12 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
 
     CComPtr<IShellBrowser> pisb;
     hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pisb));
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
 
-    IUnknown_GetWindow(pisb, &topLevelWindow);
+    hr = IUnknown_GetWindow(pisb, &topLevelWindow);
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
 
     LPWSTR input;
     int inputLength = GetWindowTextLength(fCombobox.m_hWnd) + 2;
@@ -118,12 +124,19 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
     {
         addressLength += 2;
         address = new WCHAR[addressLength];
-        ExpandEnvironmentStrings(input, address, 0);
+        if (!ExpandEnvironmentStrings(input, address, addressLength))
+        {
+            delete[] address;
+            address = input;
+        }
     }
 
     CComPtr<IShellFolder> psfDesktop;
     hr = SHGetDesktopFolder(&psfDesktop);
-    hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes);
+    if (SUCCEEDED(hr))
+    {
+        hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes);
+    }
 
     if (address != input)
         delete [] address;
@@ -171,8 +184,21 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Save(long paramC)
 HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(
     HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
 {
-    // handle fill of listbox here
-    return E_NOTIMPL;
+    LPNMHDR hdr;
+
+    *theResult = 0;
+
+    switch (uMsg)
+    {
+    case WM_NOTIFY:
+        hdr = (LPNMHDR) lParam;
+        if (hdr->code == CBEN_ENDEDIT)
+        {
+            ParseNow(0);
+        }
+        break;
+    }
+    return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE CAddressEditBox::IsWindowOwner(HWND hWnd)