Author: dquintana
Date: Tue Feb 18 11:05:20 2014
New Revision: 62240
URL:
http://svn.reactos.org/svn/reactos?rev=62240&view=rev
Log:
[RSHELL]
* CMenuBand: Fix submenu creation for shell folder menus.
CORE-7881
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Tue Feb 18
11:05:20 2014
@@ -1333,9 +1333,43 @@
HRESULT CMenuSFToolbar::PopupItem(UINT uItem)
{
+ HRESULT hr;
+ UINT uId;
+ UINT uIdAncestor;
+ DWORD flags;
int index;
+ CComPtr<IShellMenuCallback> psmc;
CComPtr<IShellMenu> shellMenu;
- HRESULT hr = m_menuBand->CallCBWithPidl(GetPidlFromId(uItem, &index),
SMC_GETOBJECT, (WPARAM) &IID_IShellMenu, (LPARAM) &shellMenu);
+
+ LPITEMIDLIST pidl = GetPidlFromId(uItem, &index);
+
+ if (!pidl)
+ return E_FAIL;
+
+#ifndef USE_BUILTIN_MENUBAND
+ hr = CoCreateInstance(CLSID_MenuBand,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ IID_PPV_ARG(IShellMenu, &pShellMenu));
+#else
+ hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &shellMenu));
+#endif
+ if (FAILED(hr))
+ return hr;
+
+ m_menuBand->GetMenuInfo(&psmc, &uId, &uIdAncestor, &flags);
+
+ // FIXME: not sure waht to use as uId/uIdAncestor here
+ hr = shellMenu->Initialize(psmc, 0, uId, SMINIT_VERTICAL);
+ if (FAILED(hr))
+ return hr;
+
+ CComPtr<IShellFolder> childFolder;
+ hr = m_shellFolder->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder,
&childFolder));
+ if (FAILED(hr))
+ return hr;
+
+ hr = shellMenu->SetShellFolder(childFolder, NULL, NULL, 0);
if (FAILED(hr))
return hr;