[SHELL32] Follow up of #2021 (#2022)

- Delete IObjectWithSite interface.
- Use PIDLIST_ABSOLUTE and PITEMID_CHILD rather than LPITEMIDLIST.
- Move CLSID_SendToMenu to shlguid_undoc.h.
- Delete unnecessary codes.
CORE-12562
This commit is contained in:
Katayama Hirofumi MZ 2019-11-11 00:37:23 +09:00 committed by GitHub
parent 5d85d534e0
commit 3b2ead064f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 141 additions and 222 deletions

View file

@ -19,23 +19,21 @@
*/ */
#include "precomp.h" #include "precomp.h"
#define INITGUID
#include <guiddef.h>
#define MAX_ITEM_COUNT 64
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
DEFINE_GUID(CLSID_SendToMenu, 0x7BA4C740, 0x9E81, 0x11CF,
0x99, 0xD3, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
CSendToMenu::CSendToMenu() CSendToMenu::CSendToMenu()
: m_hSubMenu(NULL) : m_hSubMenu(NULL)
, m_pItems(NULL) , m_pItems(NULL)
, m_idCmdFirst(0) , m_idCmdFirst(0)
{ {
SHGetDesktopFolder(&m_pDesktop); HRESULT hr = SHGetDesktopFolder(&m_pDesktop);
m_pSendTo = GetSpecialFolder(NULL, CSIDL_SENDTO); if (FAILED(hr))
{
ERR("SHGetDesktopFolder: %08lX\n", hr);
}
GetSpecialFolder(NULL, &m_pSendTo, CSIDL_SENDTO);
} }
CSendToMenu::~CSendToMenu() CSendToMenu::~CSendToMenu()
@ -68,8 +66,19 @@ HRESULT CSendToMenu::DoDrop(IDataObject *pDataObject, IDropTarget *pDropTarget)
POINTL ptl = { 0, 0 }; POINTL ptl = { 0, 0 };
HRESULT hr = pDropTarget->DragEnter(pDataObject, dwKeyState, ptl, &dwEffect); HRESULT hr = pDropTarget->DragEnter(pDataObject, dwKeyState, ptl, &dwEffect);
if (SUCCEEDED(hr) && dwEffect != DROPEFFECT_NONE) if (FAILED_UNEXPECTEDLY(hr))
{ {
pDropTarget->DragLeave();
return hr;
}
if (dwEffect == DROPEFFECT_NONE)
{
ERR("DROPEFFECT_NONE\n");
pDropTarget->DragLeave();
return E_FAIL;
}
// THIS CODE IS NOT HUMAN-FRIENDLY. SORRY. // THIS CODE IS NOT HUMAN-FRIENDLY. SORRY.
// (We have to translate a SendTo action to a Drop action) // (We have to translate a SendTo action to a Drop action)
if (bShift && bCtrl) if (bShift && bCtrl)
@ -80,88 +89,59 @@ HRESULT CSendToMenu::DoDrop(IDataObject *pDataObject, IDropTarget *pDropTarget)
dwEffect = DROPEFFECT_COPY; dwEffect = DROPEFFECT_COPY;
hr = pDropTarget->Drop(pDataObject, dwKeyState, ptl, &dwEffect); hr = pDropTarget->Drop(pDataObject, dwKeyState, ptl, &dwEffect);
} if (FAILED_UNEXPECTEDLY(hr))
else return hr;
{
ERR("DragEnter: %08lX\n", hr);
pDropTarget->DragLeave();
}
return hr; return hr;
} }
// get an IShellFolder from CSIDL // get an IShellFolder from CSIDL
IShellFolder * HRESULT
CSendToMenu::GetSpecialFolder(HWND hwnd, int csidl, LPITEMIDLIST *ppidl) CSendToMenu::GetSpecialFolder(HWND hwnd, IShellFolder **ppFolder,
int csidl, PIDLIST_ABSOLUTE *ppidl)
{ {
if (!ppFolder)
return E_POINTER;
*ppFolder = NULL;
if (ppidl) if (ppidl)
*ppidl = NULL; *ppidl = NULL;
if (!m_pDesktop) CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidl;
{
SHGetDesktopFolder(&m_pDesktop);
if (!m_pDesktop)
{
ERR("SHGetDesktopFolder\n");
return NULL;
}
}
LPITEMIDLIST pidl = NULL;
HRESULT hr = SHGetSpecialFolderLocation(hwnd, csidl, &pidl); HRESULT hr = SHGetSpecialFolderLocation(hwnd, csidl, &pidl);
if (FAILED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{ return hr;
ERR("SHGetSpecialFolderLocation: %08lX\n", hr);
return NULL;
}
IShellFolder *pFolder = NULL; IShellFolder *pFolder = NULL;
hr = m_pDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &pFolder)); hr = m_pDesktop->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &pFolder));
if (ppidl) if (ppidl)
*ppidl = pidl; *ppidl = pidl.Detach();
else
CoTaskMemFree(pidl);
if (SUCCEEDED(hr)) if (FAILED_UNEXPECTEDLY(hr))
return pFolder; return hr;
ERR("BindToObject: %08lX\n", hr); *ppFolder = pFolder;
return NULL; return hr;
} }
// get a UI object from PIDL // get a UI object from PIDL
HRESULT CSendToMenu::GetUIObjectFromPidl(HWND hwnd, LPITEMIDLIST pidl, HRESULT CSendToMenu::GetUIObjectFromPidl(HWND hwnd, PIDLIST_ABSOLUTE pidl,
REFIID riid, LPVOID *ppvOut) REFIID riid, LPVOID *ppvOut)
{ {
*ppvOut = NULL; *ppvOut = NULL;
LPCITEMIDLIST pidlLast; PCITEMID_CHILD pidlLast;
CComPtr<IShellFolder> pFolder; CComPtr<IShellFolder> pFolder;
HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &pFolder), &pidlLast); HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellFolder, &pFolder), &pidlLast);
if (FAILED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{
ERR("SHBindToParent: %08lX\n", hr);
return hr; return hr;
}
hr = pFolder->GetUIObjectOf(hwnd, 1, &pidlLast, riid, NULL, ppvOut); hr = pFolder->GetUIObjectOf(hwnd, 1, &pidlLast, riid, NULL, ppvOut);
if (FAILED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{
ERR("GetUIObjectOf: %08lX\n", hr);
}
return hr; return hr;
}
void CSendToMenu::UnloadItem(SENDTO_ITEM *pItem) return hr;
{
if (!pItem)
return;
CoTaskMemFree(pItem->pidlChild);
CoTaskMemFree(pItem->pszText);
DestroyIcon(pItem->hIcon);
HeapFree(GetProcessHeap(), 0, pItem);
} }
void CSendToMenu::UnloadAllItems() void CSendToMenu::UnloadAllItems()
@ -172,118 +152,77 @@ void CSendToMenu::UnloadAllItems()
{ {
SENDTO_ITEM *pCurItem = pItems; SENDTO_ITEM *pCurItem = pItems;
pItems = pItems->pNext; pItems = pItems->pNext;
UnloadItem(pCurItem); delete pCurItem;
} }
} }
BOOL CSendToMenu::LoadAllItems(HWND hwnd) HRESULT CSendToMenu::LoadAllItems(HWND hwnd)
{ {
UnloadAllItems(); UnloadAllItems();
LPITEMIDLIST pidlSendTo; CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlSendTo;
m_pSendTo = GetSpecialFolder(hwnd, CSIDL_SENDTO, &pidlSendTo);
if (!m_pSendTo) m_pSendTo.Release();
{ HRESULT hr = GetSpecialFolder(hwnd, &m_pSendTo, CSIDL_SENDTO, &pidlSendTo);
ERR("GetSpecialFolder\n"); if (FAILED_UNEXPECTEDLY(hr))
return FALSE; return hr;
}
HRESULT hr;
CComPtr<IEnumIDList> pEnumIDList; CComPtr<IEnumIDList> pEnumIDList;
hr = m_pSendTo->EnumObjects(hwnd, hr = m_pSendTo->EnumObjects(hwnd,
SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS,
&pEnumIDList); &pEnumIDList);
if (FAILED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{ return hr;
ERR("EnumObjects: %08lX\n", hr);
ILFree(pidlSendTo);
return FALSE;
}
BOOL bOK = TRUE; hr = S_OK;
LPITEMIDLIST pidlChild; PITEMID_CHILD child;
UINT nCount = 0; while (pEnumIDList->Next(1, &child, NULL) == S_OK)
while (pEnumIDList->Next(1, &pidlChild, NULL) == S_OK)
{ {
SENDTO_ITEM *pNewItem = (SENDTO_ITEM *)HeapAlloc(GetProcessHeap(), CComHeapPtr<ITEMID_CHILD> pidlChild(child);
HEAP_ZERO_MEMORY,
sizeof(SENDTO_ITEM));
if (!pNewItem)
{
ERR("HeapAlloc\n");
bOK = FALSE;
CoTaskMemFree(pidlChild);
break;
}
STRRET strret; STRRET strret;
hr = m_pSendTo->GetDisplayNameOf(pidlChild, SHGDN_NORMAL, &strret); hr = m_pSendTo->GetDisplayNameOf(pidlChild, SHGDN_NORMAL, &strret);
if (SUCCEEDED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{ continue;
LPWSTR pszText = NULL;
CComHeapPtr<WCHAR> pszText;
hr = StrRetToStrW(&strret, pidlChild, &pszText); hr = StrRetToStrW(&strret, pidlChild, &pszText);
if (SUCCEEDED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{ continue;
LPITEMIDLIST pidlAbsolute = ILCombine(pidlSendTo, pidlChild);
CComHeapPtr<ITEMIDLIST_ABSOLUTE> pidlAbsolute;
pidlAbsolute.Attach(ILCombine(pidlSendTo, pidlChild));
SHFILEINFOW fi = { NULL }; SHFILEINFOW fi = { NULL };
const UINT uFlags = SHGFI_PIDL | SHGFI_TYPENAME | const UINT uFlags = SHGFI_PIDL | SHGFI_TYPENAME |
SHGFI_ICON | SHGFI_SMALLICON; SHGFI_ICON | SHGFI_SMALLICON;
SHGetFileInfoW((LPCWSTR)pidlAbsolute, 0, &fi, sizeof(fi), uFlags); SHGetFileInfoW(reinterpret_cast<LPWSTR>(static_cast<PIDLIST_ABSOLUTE>(pidlAbsolute)), 0,
&fi, sizeof(fi), uFlags);
ILFree(pidlAbsolute); SENDTO_ITEM *pNewItem =
new SENDTO_ITEM(pidlChild.Detach(), pszText.Detach(), fi.hIcon);
pNewItem->pidlChild = pidlChild;
pNewItem->pszText = pszText;
pNewItem->hIcon = fi.hIcon;
if (m_pItems) if (m_pItems)
{ {
pNewItem->pNext = m_pItems; pNewItem->pNext = m_pItems;
} }
m_pItems = pNewItem; m_pItems = pNewItem;
// successful
++nCount;
if (nCount >= MAX_ITEM_COUNT)
{
break;
}
continue;
}
else
{
ERR("StrRetToStrW: %08lX\n", hr);
}
}
else
{
ERR("GetDisplayNameOf: %08lX\n", hr);
} }
UnloadItem(pNewItem); return hr;
CoTaskMemFree(pidlChild);
}
ILFree(pidlSendTo);
return bOK;
} }
UINT CSendToMenu::InsertSendToItems(HMENU hMenu, UINT idCmdFirst, UINT Pos) UINT CSendToMenu::InsertSendToItems(HMENU hMenu, UINT idCmdFirst, UINT Pos)
{ {
if (m_pItems == NULL) if (m_pItems == NULL)
{ {
if (!LoadAllItems(NULL)) HRESULT hr = LoadAllItems(NULL);
{ if (FAILED_UNEXPECTEDLY(hr))
ERR("LoadAllItems\n");
return 0; return 0;
} }
}
m_idCmdFirst = idCmdFirst; m_idCmdFirst = idCmdFirst;
UINT idCmd = idCmdFirst; UINT idCmd = idCmdFirst;
UINT nCount = 0;
for (SENDTO_ITEM *pCurItem = m_pItems; pCurItem; pCurItem = pCurItem->pNext) for (SENDTO_ITEM *pCurItem = m_pItems; pCurItem; pCurItem = pCurItem->pNext)
{ {
const UINT uFlags = MF_BYPOSITION | MF_STRING | MF_ENABLED; const UINT uFlags = MF_BYPOSITION | MF_STRING | MF_ENABLED;
@ -292,26 +231,19 @@ UINT CSendToMenu::InsertSendToItems(HMENU hMenu, UINT idCmdFirst, UINT Pos)
MENUITEMINFOW mii; MENUITEMINFOW mii;
mii.cbSize = sizeof(mii); mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_BITMAP; mii.fMask = MIIM_DATA | MIIM_BITMAP;
mii.dwItemData = (ULONG_PTR)pCurItem; mii.dwItemData = reinterpret_cast<ULONG_PTR>(pCurItem);
mii.hbmpItem = HBMMENU_CALLBACK; mii.hbmpItem = HBMMENU_CALLBACK;
SetMenuItemInfoW(hMenu, idCmd, FALSE, &mii); SetMenuItemInfoW(hMenu, idCmd, FALSE, &mii);
++idCmd; ++idCmd;
// successful // successful
++nCount;
if (nCount >= MAX_ITEM_COUNT)
{
break;
}
} }
} }
if (idCmd == idCmdFirst) if (idCmd == idCmdFirst)
{ {
WCHAR szNone[64] = L"(None)"; CStringW strNone(MAKEINTRESOURCEW(IDS_NONE));
LoadStringW(shell32_hInstance, IDS_NONE, szNone, _countof(szNone)); AppendMenuW(hMenu, MF_GRAYED | MF_DISABLED | MF_STRING, idCmd, strNone);
AppendMenuW(hMenu, MF_GRAYED | MF_DISABLED | MF_STRING, idCmd, szNone);
} }
return idCmd - idCmdFirst; return idCmd - idCmdFirst;
@ -324,9 +256,9 @@ CSendToMenu::SENDTO_ITEM *CSendToMenu::FindItemFromIdOffset(UINT IdOffset)
MENUITEMINFOW mii = { sizeof(mii) }; MENUITEMINFOW mii = { sizeof(mii) };
mii.fMask = MIIM_DATA; mii.fMask = MIIM_DATA;
if (GetMenuItemInfoW(m_hSubMenu, idCmd, FALSE, &mii)) if (GetMenuItemInfoW(m_hSubMenu, idCmd, FALSE, &mii))
return (SENDTO_ITEM *)mii.dwItemData; return reinterpret_cast<SENDTO_ITEM *>(mii.dwItemData);
ERR("GetMenuItemInfoW\n"); ERR("GetMenuItemInfoW: %ld\n", GetLastError());
return NULL; return NULL;
} }
@ -340,35 +272,18 @@ HRESULT CSendToMenu::DoSendToItem(SENDTO_ITEM *pItem, LPCMINVOKECOMMANDINFO lpic
HRESULT hr; HRESULT hr;
CComPtr<IDropTarget> pDropTarget; CComPtr<IDropTarget> pDropTarget;
LPITEMIDLIST pidlChild = pItem->pidlChild; hr = m_pSendTo->GetUIObjectOf(NULL, 1, &pItem->pidlChild, IID_IDropTarget,
hr = m_pSendTo->GetUIObjectOf(NULL, 1, &pidlChild, IID_IDropTarget,
NULL, (LPVOID *)&pDropTarget); NULL, (LPVOID *)&pDropTarget);
if (SUCCEEDED(hr)) if (FAILED_UNEXPECTEDLY(hr))
{ return hr;
hr = DoDrop(m_pDataObject, pDropTarget); hr = DoDrop(m_pDataObject, pDropTarget);
} if (FAILED_UNEXPECTEDLY(hr))
else return hr;
{
ERR("GetUIObjectOf: %08lX\n", hr);
}
return hr; return hr;
} }
STDMETHODIMP CSendToMenu::SetSite(IUnknown *pUnkSite)
{
m_pSite = pUnkSite;
return S_OK;
}
STDMETHODIMP CSendToMenu::GetSite(REFIID riid, void **ppvSite)
{
if (!m_pSite)
return E_FAIL;
return m_pSite->QueryInterface(riid, ppvSite);
}
STDMETHODIMP STDMETHODIMP
CSendToMenu::QueryContextMenu(HMENU hMenu, CSendToMenu::QueryContextMenu(HMENU hMenu,
UINT indexMenu, UINT indexMenu,
@ -379,36 +294,28 @@ CSendToMenu::QueryContextMenu(HMENU hMenu,
TRACE("%p %p %u %u %u %u\n", this, TRACE("%p %p %u %u %u %u\n", this,
hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
WCHAR wszSendTo[64];
if (!LoadStringW(shell32_hInstance, IDS_SENDTO,
wszSendTo, _countof(wszSendTo)))
{
ERR("IDS_SENDTO\n");
return E_FAIL;
}
HMENU hSubMenu = CreateMenu(); HMENU hSubMenu = CreateMenu();
if (!hSubMenu) if (!hSubMenu)
{ {
ERR("CreateMenu\n"); ERR("CreateMenu: %ld\n", GetLastError());
return E_FAIL; return E_FAIL;
} }
UINT cItems = InsertSendToItems(hSubMenu, idCmdFirst, 0); UINT cItems = InsertSendToItems(hSubMenu, idCmdFirst, 0);
MENUITEMINFOW mii; CStringW strSendTo(MAKEINTRESOURCEW(IDS_SENDTO));
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii); MENUITEMINFOW mii = { sizeof(mii) };
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE | MIIM_SUBMENU; mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
mii.fType = MFT_STRING; mii.fType = MFT_STRING;
mii.wID = -1; mii.wID = -1;
mii.dwTypeData = wszSendTo; mii.dwTypeData = strSendTo.GetBuffer();
mii.cch = wcslen(mii.dwTypeData); mii.cch = wcslen(mii.dwTypeData);
mii.fState = MFS_ENABLED; mii.fState = MFS_ENABLED;
mii.hSubMenu = hSubMenu; mii.hSubMenu = hSubMenu;
if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) if (!InsertMenuItemW(hMenu, indexMenu, TRUE, &mii))
{ {
ERR("InsertMenuItemW\n"); ERR("InsertMenuItemW: %ld\n", GetLastError());
return E_FAIL; return E_FAIL;
} }
@ -432,10 +339,6 @@ CSendToMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{ {
hr = DoSendToItem(pItem, lpici); hr = DoSendToItem(pItem, lpici);
} }
else
{
ERR("FindItemFromIdOffset\n");
}
TRACE("CSendToMenu::InvokeCommand %x\n", hr); TRACE("CSendToMenu::InvokeCommand %x\n", hr);
return hr; return hr;
@ -491,17 +394,19 @@ CSendToMenu::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam,
if (!lpdis || lpdis->CtlType != ODT_MENU) if (!lpdis || lpdis->CtlType != ODT_MENU)
break; break;
SENDTO_ITEM *pItem = (SENDTO_ITEM *)lpdis->itemData; SENDTO_ITEM *pItem = reinterpret_cast<SENDTO_ITEM *>(lpdis->itemData);
HICON hIcon = NULL; HICON hIcon = NULL;
if (pItem) if (pItem)
hIcon = pItem->hIcon; hIcon = pItem->hIcon;
if (!hIcon) if (!hIcon)
break; break;
RECT rcItem = lpdis->rcItem; const RECT& rcItem = lpdis->rcItem;
DrawIconEx(lpdis->hDC, 2, INT x = 4;
lpdis->rcItem.top + (rcItem.bottom - rcItem.top - 16) / 2, INT y = lpdis->rcItem.top;
hIcon, cxSmall, cySmall, 0, NULL, DI_NORMAL); y += (rcItem.bottom - rcItem.top - cySmall) / 2;
DrawIconEx(lpdis->hDC, x, y, hIcon, cxSmall, cySmall,
0, NULL, DI_NORMAL);
if (plResult) if (plResult)
*plResult = TRUE; *plResult = TRUE;

View file

@ -26,30 +26,47 @@ extern "C" const GUID CLSID_SendToMenu;
class CSendToMenu : class CSendToMenu :
public CComCoClass<CSendToMenu, &CLSID_SendToMenu>, public CComCoClass<CSendToMenu, &CLSID_SendToMenu>,
public CComObjectRootEx<CComMultiThreadModelNoCS>, public CComObjectRootEx<CComMultiThreadModelNoCS>,
public IObjectWithSite,
public IContextMenu3, public IContextMenu3,
public IShellExtInit public IShellExtInit
{ {
private: private:
struct SENDTO_ITEM struct SENDTO_ITEM
{ {
LPITEMIDLIST pidlChild; SENDTO_ITEM *pNext;
PITEMID_CHILD pidlChild;
LPWSTR pszText; LPWSTR pszText;
HICON hIcon; HICON hIcon;
SENDTO_ITEM *pNext;
SENDTO_ITEM(PITEMID_CHILD child, LPWSTR text, HICON icon)
: pNext(NULL)
, pidlChild(child)
, pszText(text)
, hIcon(icon)
{
}
~SENDTO_ITEM()
{
CoTaskMemFree(pidlChild);
CoTaskMemFree(pszText);
DestroyIcon(hIcon);
}
private:
SENDTO_ITEM();
SENDTO_ITEM(const SENDTO_ITEM&);
SENDTO_ITEM& operator=(const SENDTO_ITEM&);
}; };
HMENU m_hSubMenu; HMENU m_hSubMenu;
SENDTO_ITEM *m_pItems; SENDTO_ITEM *m_pItems;
UINT m_idCmdFirst; UINT m_idCmdFirst;
CComPtr<IUnknown> m_pSite;
CComPtr<IShellFolder> m_pDesktop; CComPtr<IShellFolder> m_pDesktop;
CComPtr<IShellFolder> m_pSendTo; CComPtr<IShellFolder> m_pSendTo;
CComPtr<IDataObject> m_pDataObject; CComPtr<IDataObject> m_pDataObject;
BOOL LoadAllItems(HWND hwnd); HRESULT LoadAllItems(HWND hwnd);
void UnloadItem(SENDTO_ITEM *pItem);
void UnloadAllItems(); void UnloadAllItems();
UINT InsertSendToItems(HMENU hMenu, UINT idFirst, UINT idMenu); UINT InsertSendToItems(HMENU hMenu, UINT idFirst, UINT idMenu);
@ -58,17 +75,14 @@ private:
HRESULT DoSendToItem(SENDTO_ITEM *pItem, LPCMINVOKECOMMANDINFO lpici); HRESULT DoSendToItem(SENDTO_ITEM *pItem, LPCMINVOKECOMMANDINFO lpici);
HRESULT DoDrop(IDataObject *pDataObject, IDropTarget *pDropTarget); HRESULT DoDrop(IDataObject *pDataObject, IDropTarget *pDropTarget);
IShellFolder *GetSpecialFolder(HWND hwnd, int csidl, LPITEMIDLIST *ppidl = NULL); HRESULT GetSpecialFolder(HWND hwnd, IShellFolder **ppFolder, int csidl,
HRESULT GetUIObjectFromPidl(HWND hwnd, LPITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut); PIDLIST_ABSOLUTE *ppidl = NULL);
HRESULT GetUIObjectFromPidl(HWND hwnd, PIDLIST_ABSOLUTE pidl, REFIID riid, LPVOID *ppvOut);
public: public:
CSendToMenu(); CSendToMenu();
~CSendToMenu(); ~CSendToMenu();
// IObjectWithSite
STDMETHODIMP SetSite(IUnknown *pUnkSite);
STDMETHODIMP GetSite(REFIID riid, void **ppvSite);
// IContextMenu // IContextMenu
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
@ -88,7 +102,6 @@ public:
DECLARE_PROTECT_FINAL_CONSTRUCT() DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CSendToMenu) BEGIN_COM_MAP(CSendToMenu)
COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu3, IContextMenu3) COM_INTERFACE_ENTRY_IID(IID_IContextMenu3, IContextMenu3)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)

View file

@ -137,6 +137,7 @@ DEFINE_GUID(CLSID_SysTray, 0x35CEC8A3, 0x2BE6, 0x11D2, 0x87, 0x7
DEFINE_GUID(CLSID_BackgroundTaskScheduler, 0x603D3800, 0xBD81, 0x11d0, 0xA3, 0xA5, 0x00, 0xC0, 0x4F, 0xD7, 0x06, 0xEC); DEFINE_GUID(CLSID_BackgroundTaskScheduler, 0x603D3800, 0xBD81, 0x11d0, 0xA3, 0xA5, 0x00, 0xC0, 0x4F, 0xD7, 0x06, 0xEC);
DEFINE_GUID(CLSID_SharedTaskScheduler, 0x603D3801, 0xBD81, 0x11d0, 0xA3, 0xA5, 0x00, 0xC0, 0x4F, 0xD7, 0x06, 0xEC); DEFINE_GUID(CLSID_SharedTaskScheduler, 0x603D3801, 0xBD81, 0x11d0, 0xA3, 0xA5, 0x00, 0xC0, 0x4F, 0xD7, 0x06, 0xEC);
DEFINE_GUID(CLSID_SendToMenu, 0x7BA4C740, 0x9E81, 0x11CF, 0x99, 0xD3, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
/* The following list of interfaces was taken from here: http://www.geoffchappell.com/studies/windows/shell/shell32/interfaces/index.htm */ /* The following list of interfaces was taken from here: http://www.geoffchappell.com/studies/windows/shell/shell32/interfaces/index.htm */
DEFINE_GUID(IID_IAggregateFilterCondition, 0x86228AA3, 0xA736, 0x4733, 0xBD, 0x8A, 0x10, 0xA8, 0x3C, 0x69, 0xBF, 0x84); DEFINE_GUID(IID_IAggregateFilterCondition, 0x86228AA3, 0xA736, 0x4733, 0xBD, 0x8A, 0x10, 0xA8, 0x3C, 0x69, 0xBF, 0x84);