Author: gadamopoulos
Date: Mon May 30 20:52:05 2016
New Revision: 71463
URL:
http://svn.reactos.org/svn/reactos?rev=71463&view=rev
Log:
[BROWSEUI]
- Move the implementation of the search button from CInternetToolbar to CShellBrowser.
- Part of the work submitted by Sylvain Deverre.
CORE-8814 and CORE-10838
Modified:
trunk/reactos/dll/win32/browseui/internettoolbar.cpp
trunk/reactos/dll/win32/browseui/shellbrowser.cpp
Modified: trunk/reactos/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/interne…
==============================================================================
--- trunk/reactos/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Mon May 30 20:52:05
2016
@@ -1503,33 +1503,7 @@
LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled)
{
- CComPtr<IObjectWithSite> objectWithSite;
- CComPtr<IContextMenu> contextMenu;
- CMINVOKECOMMANDINFO commandInfo;
- const char *searchGUID =
"{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
- HRESULT hResult;
-
- // TODO: Query shell if this command is enabled first
-
- memset(&commandInfo, 0, sizeof(commandInfo));
- commandInfo.cbSize = sizeof(commandInfo);
- commandInfo.hwnd = m_hWnd;
- commandInfo.lpParameters = searchGUID;
- commandInfo.nShow = SW_SHOWNORMAL;
-
- hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
- IID_PPV_ARG(IContextMenu, &contextMenu));
- if (FAILED_UNEXPECTEDLY(hResult))
- return 0;
- hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite,
&objectWithSite));
- if (FAILED_UNEXPECTEDLY(hResult))
- return 0;
- hResult = objectWithSite->SetSite(fSite);
- if (FAILED_UNEXPECTEDLY(hResult))
- return 0;
- hResult = contextMenu->InvokeCommand(&commandInfo);
- hResult = objectWithSite->SetSite(NULL);
- return 0;
+ return IUnknown_Exec(fSite, CLSID_CommonButtons, 0x123, 1, NULL, NULL);
}
LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL
&bHandled)
Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Mon May 30 20:52:05
2016
@@ -345,6 +345,7 @@
HRESULT UpdateUpState();
void UpdateGotoMenu(HMENU theMenu);
void UpdateViewMenu(HMENU theMenu);
+ HRESULT OnSearch();
/* // *** IDockingWindowFrame methods ***
virtual HRESULT STDMETHODCALLTYPE AddToolbar(IUnknown *punkSrc, LPCWSTR pwszItem,
DWORD dwAddFlags);
@@ -1638,6 +1639,37 @@
SHEnableMenuItem(theMenu, IDM_VIEW_EXPLORERBAR, FALSE);
}
+HRESULT CShellBrowser::OnSearch()
+{
+ CComPtr<IObjectWithSite> objectWithSite;
+ CComPtr<IContextMenu> contextMenu;
+ CMINVOKECOMMANDINFO commandInfo;
+ const char *searchGUID =
"{169A0691-8DF9-11d1-A1C4-00C04FD75D13}";
+ HRESULT hResult;
+
+ // TODO: Query shell if this command is enabled first
+
+ memset(&commandInfo, 0, sizeof(commandInfo));
+ commandInfo.cbSize = sizeof(commandInfo);
+ commandInfo.hwnd = m_hWnd;
+ commandInfo.lpParameters = searchGUID;
+ commandInfo.nShow = SW_SHOWNORMAL;
+
+ hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IContextMenu, &contextMenu));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return 0;
+ hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite,
&objectWithSite));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return 0;
+ hResult = objectWithSite->SetSite(dynamic_cast<IShellBrowser*>(this));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return 0;
+ hResult = contextMenu->InvokeCommand(&commandInfo);
+ hResult = objectWithSite->SetSite(NULL);
+ return hResult;
+}
+
bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
{
CComPtr<IUnknown> int1Retry;
@@ -1866,6 +1898,20 @@
break;
}
}
+ else if (IsEqualIID(*pguidCmdGroup, CLSID_CommonButtons))
+ {
+ // Windows seems to use this as proxy for toolbar buttons.
+ // We use it for search band for now to remove code duplication,
+ // let's see if it could be useful in the future.
+ switch (nCmdID)
+ {
+ case 0x123:
+ // Show search band from toolbar
+ OnSearch();
+ return S_OK;
+ }
+ return E_NOTIMPL;
+ }
else
{
return E_NOTIMPL;