ReactOS 0.4.15-dev-8231-g29a56f3
CNewMenu.h
Go to the documentation of this file.
1/*
2 * provides new shell item service
3 *
4 * Copyright 2007 Johannes Anderwald (johannes.anderwald@reactos.org)
5 * Copyright 2009 Andrew Hill
6 * Copyright 2012 Rafal Harabien
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#ifndef _SHV_ITEM_NEW_H_
24#define _SHV_ITEM_NEW_H_
25
26const WCHAR ShellNewKey[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discardable\\PostSetup\\ShellNew";
27
28class CNewMenu :
29 public CComCoClass<CNewMenu, &CLSID_NewMenu>,
30 public CComObjectRootEx<CComMultiThreadModelNoCS>,
31 public IObjectWithSite,
32 public IContextMenu3,
33 public IShellExtInit
34{
35private:
37 {
43 };
44
46 {
54 };
55
58 SHELLNEW_ITEM *m_pLinkItem; // Points to the link handler item in the m_pItems list.
59 CComPtr<IUnknown> m_pSite;
64
66 void UnloadItem(SHELLNEW_ITEM *pItem);
67 void UnloadAllItems();
71 UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
75 HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename);
78 DWORD cchNameMax, LPCWSTR wszPath);
79
80public:
81 CNewMenu();
82 ~CNewMenu();
83
84 // IObjectWithSite
85 STDMETHOD(SetSite)(IUnknown *pUnkSite) override;
86 STDMETHOD(GetSite)(REFIID riid, void **ppvSite) override;
87
88 // IContextMenu
89 STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
91 STDMETHOD(GetCommandString)(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
92
93 // IContextMenu3
94 STDMETHOD(HandleMenuMsg2)(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override;
95
96 // IContextMenu2
98
99 // IShellExtInit
100 STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
101
104
106
109 COM_INTERFACE_ENTRY_IID(IID_IContextMenu3, IContextMenu3)
110 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
111 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
112 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
114};
115
116#endif /* _SHV_ITEM_NEW_H_ */
const WCHAR ShellNewKey[]
Definition: CNewMenu.h:26
#define STDMETHOD(m)
Definition: basetyps.h:62
HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename)
Definition: CNewMenu.cpp:413
STDMETHOD() GetSite(REFIID riid, void **ppvSite) override
Definition: CNewMenu.cpp:623
STDMETHOD() QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
Definition: CNewMenu.cpp:630
STDMETHOD() SetSite(IUnknown *pUnkSite) override
Definition: CNewMenu.cpp:617
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu)
Definition: CNewMenu.cpp:323
STDMETHOD() GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
Definition: CNewMenu.cpp:691
HICON m_hIconFolder
Definition: CNewMenu.h:63
HRESULT NewItemByNonCommand(SHELLNEW_ITEM *pItem, LPWSTR wszName, DWORD cchNameMax, LPCWSTR wszPath)
Definition: CNewMenu.cpp:524
CNewMenu()
Definition: CNewMenu.cpp:28
SHELLNEW_TYPE
Definition: CNewMenu.h:37
@ SHELLNEW_TYPE_COMMAND
Definition: CNewMenu.h:39
@ SHELLNEW_TYPE_FILENAME
Definition: CNewMenu.h:41
@ SHELLNEW_TYPE_DATA
Definition: CNewMenu.h:40
@ SHELLNEW_TYPE_NULLFILE
Definition: CNewMenu.h:42
@ SHELLNEW_TYPE_INVALID
Definition: CNewMenu.h:38
BOOL m_bCustomIconLink
Definition: CNewMenu.h:62
UINT m_idCmdLink
Definition: CNewMenu.h:61
LPITEMIDLIST m_pidlFolder
Definition: CNewMenu.h:56
BOOL LoadCachedItems()
Definition: CNewMenu.cpp:248
void UnloadItem(SHELLNEW_ITEM *pItem)
Definition: CNewMenu.cpp:55
BOOL LoadAllItems()
Definition: CNewMenu.cpp:306
SHELLNEW_ITEM * m_pLinkItem
Definition: CNewMenu.h:58
BOOL m_bCustomIconFolder
Definition: CNewMenu.h:62
HICON m_hIconLink
Definition: CNewMenu.h:63
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi)
Definition: CNewMenu.cpp:580
STDMETHOD() HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
Definition: CNewMenu.cpp:705
HMENU m_hSubMenu
Definition: CNewMenu.h:60
void UnloadAllItems()
Definition: CNewMenu.cpp:68
STDMETHOD() HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
Definition: CNewMenu.cpp:712
SHELLNEW_ITEM * LoadItem(LPCWSTR pwszExt)
Definition: CNewMenu.cpp:83
SHELLNEW_ITEM * m_pItems
Definition: CNewMenu.h:57
~CNewMenu()
Definition: CNewMenu.cpp:43
UINT m_idCmdFirst
Definition: CNewMenu.h:61
UINT m_idCmdFolder
Definition: CNewMenu.h:61
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
Definition: CNewMenu.cpp:670
HRESULT NewItemByCommand(SHELLNEW_ITEM *pItem, LPCWSTR wszPath)
Definition: CNewMenu.cpp:481
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici)
Definition: CNewMenu.cpp:452
SHELLNEW_ITEM * FindItemFromIdOffset(UINT IdOffset)
Definition: CNewMenu.cpp:391
BOOL CacheItems()
Definition: CNewMenu.cpp:176
CComPtr< IUnknown > m_pSite
Definition: CNewMenu.h:59
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
UINT uFlags
Definition: api.c:59
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:645
#define END_COM_MAP()
Definition: atlcom.h:592
static HICON
Definition: imagelist.c:84
const IID IID_IObjectWithSite
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
#define IDR_NEWMENU
Definition: shresdef.h:896
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
SHELLNEW_ITEM * pNext
Definition: CNewMenu.h:53
SHELLNEW_TYPE Type
Definition: CNewMenu.h:47
uint32_t ULONG
Definition: typedefs.h:59
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
static void Initialize()
Definition: xlate.c:212
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185