mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[SHELL32] CNewMenu: Don't use CWM_GETISHELLBROWSER.
CDefaultContextMenu: Set the site for context menu extensions CNewMenu: Get SID_IFolderView service of the site to get the IShellView
This commit is contained in:
parent
b97886ea9f
commit
67f99833cd
3 changed files with 13 additions and 13 deletions
|
@ -376,6 +376,9 @@ CDefaultContextMenu::LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *pclsi
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_site)
|
||||||
|
IUnknown_SetSite(pcm, m_site);
|
||||||
|
|
||||||
PDynamicShellEntry pEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(DynamicShellEntry));
|
PDynamicShellEntry pEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(DynamicShellEntry));
|
||||||
if (!pEntry)
|
if (!pEntry)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
|
@ -404,7 +404,7 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::FindItemFromIdOffset(UINT IdOffset)
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CNewMenu::SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG wEventId, UINT uFlags, LPWSTR pszName)
|
HRESULT CNewMenu::SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName)
|
||||||
{
|
{
|
||||||
CComPtr<IShellBrowser> lpSB;
|
CComPtr<IShellBrowser> lpSB;
|
||||||
CComPtr<IShellView> lpSV;
|
CComPtr<IShellView> lpSV;
|
||||||
|
@ -415,16 +415,13 @@ HRESULT CNewMenu::SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG wEventId, UINT
|
||||||
/* Notify the view object about the new item */
|
/* Notify the view object about the new item */
|
||||||
SHChangeNotify(wEventId, uFlags, (LPCVOID) pszName, NULL);
|
SHChangeNotify(wEventId, uFlags, (LPCVOID) pszName, NULL);
|
||||||
|
|
||||||
/* FIXME: I think that this can be implemented using callbacks to the shell folder */
|
if (!m_pSite)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
/* Note: CWM_GETISHELLBROWSER returns shell browser without adding reference */
|
/* Get a pointer to the shell view */
|
||||||
lpSB = (LPSHELLBROWSER)SendMessageA(lpici->hwnd, CWM_GETISHELLBROWSER, 0, 0);
|
hr = IUnknown_QueryService(m_pSite, SID_IFolderView, IID_PPV_ARG(IShellView, &lpSV));
|
||||||
if (!lpSB)
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return E_FAIL;
|
return S_OK;
|
||||||
|
|
||||||
hr = lpSB->QueryActiveShellView(&lpSV);
|
|
||||||
if (FAILED(hr))
|
|
||||||
return hr;
|
|
||||||
|
|
||||||
/* Attempt to get the pidl of the new item */
|
/* Attempt to get the pidl of the new item */
|
||||||
hr = SHILCreateFromPathW(pszName, &pidl, NULL);
|
hr = SHILCreateFromPathW(pszName, &pidl, NULL);
|
||||||
|
@ -466,7 +463,7 @@ HRESULT CNewMenu::CreateNewFolder(LPCMINVOKECOMMANDINFO lpici)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
/* Show and select the new item in the def view */
|
/* Show and select the new item in the def view */
|
||||||
SelectNewItem(lpici, SHCNE_MKDIR, SHCNF_PATHW, wszName);
|
SelectNewItem(SHCNE_MKDIR, SHCNF_PATHW, wszName);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -572,7 +569,7 @@ HRESULT CNewMenu::CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcm
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
{
|
{
|
||||||
TRACE("Notifying fs %s\n", debugstr_w(wszName));
|
TRACE("Notifying fs %s\n", debugstr_w(wszName));
|
||||||
SelectNewItem(lpcmi, SHCNE_CREATE, SHCNF_PATHW, wszName);
|
SelectNewItem(SHCNE_CREATE, SHCNF_PATHW, wszName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
SHELLNEW_ITEM *FindItemFromIdOffset(UINT IdOffset);
|
SHELLNEW_ITEM *FindItemFromIdOffset(UINT IdOffset);
|
||||||
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici);
|
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici);
|
||||||
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi);
|
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi);
|
||||||
HRESULT SelectNewItem(LPCMINVOKECOMMANDINFO lpici, LONG wEventId, UINT uFlags, LPWSTR pszName);
|
HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CNewMenu();
|
CNewMenu();
|
||||||
|
|
Loading…
Reference in a new issue