[SHELLFIND] Add search bar click handler for testing search results
authorBrock Mammen <brockmammen@gmail.com>
Fri, 19 Jul 2019 22:08:38 +0000 (17:08 -0500)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sun, 15 Sep 2019 16:46:36 +0000 (19:46 +0300)
dll/win32/browseui/shellfind/CSearchBar.cpp
dll/win32/browseui/shellfind/CSearchBar.h

index f2329b6..8035216 100644 (file)
@@ -134,6 +134,29 @@ LRESULT CSearchBar::OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndC
     return pShellBrowser->BrowseObject(findFolderPidl, 0);
 }
 
+LRESULT CSearchBar::OnClicked(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
+{
+    HRESULT hr;
+    CComPtr<IShellBrowser> pShellBrowser;
+    hr = IUnknown_QueryService(pSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pShellBrowser));
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
+    CComPtr<IShellView> pShellView;
+    hr = pShellBrowser->QueryActiveShellView(&pShellView);
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
+    HWND hwnd;
+    hr = pShellView->GetWindow(&hwnd);
+    if (FAILED_UNEXPECTEDLY(hr))
+        return hr;
+
+    LPWSTR path = (LPWSTR) L"C:\\readme.txt";
+
+    // TODO: Use message ID in header file
+    ::PostMessageW(hwnd, WM_USER, 0, (LPARAM) StrDupW(path));
+    return 0;
+}
+
 
 // *** IOleWindow methods ***
 HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow(HWND *lphwnd)
index 81c9455..3bef420 100644 (file)
@@ -48,6 +48,7 @@ private:
     // *** ATL event handlers ***
     LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
     LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
+    LRESULT OnClicked(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
 
 public:
     CSearchBar();
@@ -136,5 +137,6 @@ public:
     BEGIN_MSG_MAP(CSearchBar)
         MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
         COMMAND_CODE_HANDLER(BN_CLICKED, OnSearchButtonClicked)
+        MESSAGE_HANDLER(WM_LBUTTONDOWN, OnClicked)
     END_MSG_MAP()
 };