mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 08:01:53 +00:00
[SHELLFIND] Open search results folder with search button
This commit is contained in:
parent
4212f4b175
commit
7544656b85
2 changed files with 24 additions and 0 deletions
|
@ -112,6 +112,28 @@ LRESULT CSearchBar::OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bH
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LRESULT CSearchBar::OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
|
||||||
|
{
|
||||||
|
CComPtr<IShellBrowser> pShellBrowser;
|
||||||
|
HRESULT hr = IUnknown_QueryService(pSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pShellBrowser));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
WCHAR szShellGuid[MAX_PATH];
|
||||||
|
const WCHAR shellGuidPrefix[] = L"shell:::";
|
||||||
|
memcpy(szShellGuid, shellGuidPrefix, sizeof(shellGuidPrefix));
|
||||||
|
hr = StringFromGUID2(CLSID_FindFolder, szShellGuid + _countof(shellGuidPrefix) - 1, _countof(szShellGuid) - _countof(shellGuidPrefix));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
LPITEMIDLIST findFolderPidl;
|
||||||
|
hr = SHParseDisplayName(szShellGuid, NULL, &findFolderPidl, 0, NULL);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
return pShellBrowser->BrowseObject(findFolderPidl, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// *** IOleWindow methods ***
|
// *** IOleWindow methods ***
|
||||||
HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow(HWND *lphwnd)
|
HRESULT STDMETHODCALLTYPE CSearchBar::GetWindow(HWND *lphwnd)
|
||||||
|
|
|
@ -47,6 +47,7 @@ private:
|
||||||
|
|
||||||
// *** ATL event handlers ***
|
// *** ATL event handlers ***
|
||||||
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
|
||||||
|
LRESULT OnSearchButtonClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSearchBar();
|
CSearchBar();
|
||||||
|
@ -134,5 +135,6 @@ public:
|
||||||
|
|
||||||
BEGIN_MSG_MAP(CSearchBar)
|
BEGIN_MSG_MAP(CSearchBar)
|
||||||
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
|
||||||
|
COMMAND_CODE_HANDLER(BN_CLICKED, OnSearchButtonClicked)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue