2 * provides new shell item service
4 * Copyright 2019 Katayama Hirofumi MZ.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _SHV_ITEM_SENDTO_H_
22 #define _SHV_ITEM_SENDTO_H_
24 extern "C" const GUID CLSID_SendToMenu
;
27 public CComCoClass
<CSendToMenu
, &CLSID_SendToMenu
>,
28 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
36 PITEMID_CHILD pidlChild
;
40 SENDTO_ITEM(PITEMID_CHILD child
, LPWSTR text
, HICON icon
)
50 CoTaskMemFree(pidlChild
);
51 CoTaskMemFree(pszText
);
57 SENDTO_ITEM(const SENDTO_ITEM
&);
58 SENDTO_ITEM
& operator=(const SENDTO_ITEM
&);
62 SENDTO_ITEM
*m_pItems
;
65 CComPtr
<IShellFolder
> m_pDesktop
;
66 CComPtr
<IShellFolder
> m_pSendTo
;
67 CComPtr
<IDataObject
> m_pDataObject
;
69 HRESULT
LoadAllItems(HWND hwnd
);
70 void UnloadAllItems();
72 BOOL
FolderHasAnyItems() const;
73 HRESULT
CreateSendToFiles(LPCWSTR pszSendTo
);
75 UINT
InsertSendToItems(HMENU hMenu
, UINT idFirst
, UINT idMenu
);
77 SENDTO_ITEM
*FindItemFromIdOffset(UINT IdOffset
);
78 HRESULT
DoSendToItem(SENDTO_ITEM
*pItem
, LPCMINVOKECOMMANDINFO lpici
);
80 HRESULT
DoDrop(IDataObject
*pDataObject
, IDropTarget
*pDropTarget
);
81 HRESULT
GetSpecialFolder(HWND hwnd
, IShellFolder
**ppFolder
, int csidl
,
82 PIDLIST_ABSOLUTE
*ppidl
= NULL
);
83 HRESULT
GetUIObjectFromPidl(HWND hwnd
, PIDLIST_ABSOLUTE pidl
, REFIID riid
, LPVOID
*ppvOut
);
90 STDMETHODIMP
QueryContextMenu(HMENU hMenu
, UINT indexMenu
, UINT idCmdFirst
, UINT idCmdLast
, UINT uFlags
);
91 STDMETHODIMP
InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi
);
92 STDMETHODIMP
GetCommandString(UINT_PTR idCommand
, UINT uFlags
, UINT
*lpReserved
, LPSTR lpszName
, UINT uMaxNameLen
);
95 STDMETHODIMP
HandleMenuMsg2(UINT uMsg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
);
98 STDMETHODIMP
HandleMenuMsg(UINT uMsg
, WPARAM wParam
, LPARAM lParam
);
101 STDMETHODIMP
Initialize(PCIDLIST_ABSOLUTE pidlFolder
, IDataObject
*pdtobj
, HKEY hkeyProgID
);
103 DECLARE_REGISTRY_RESOURCEID(IDR_SENDTOMENU
)
104 DECLARE_NOT_AGGREGATABLE(CSendToMenu
)
105 DECLARE_PROTECT_FINAL_CONSTRUCT()
107 BEGIN_COM_MAP(CSendToMenu
)
108 COM_INTERFACE_ENTRY_IID(IID_IContextMenu3
, IContextMenu3
)
109 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2
, IContextMenu2
)
110 COM_INTERFACE_ENTRY_IID(IID_IContextMenu
, IContextMenu
)
111 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit
, IShellExtInit
)
115 #endif /* _SHV_ITEM_SENDTO_H_ */