ReactOS 0.4.15-dev-5672-gf73ac17
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;
63
65 void UnloadItem(SHELLNEW_ITEM *pItem);
66 void UnloadAllItems();
70 UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
74 HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename);
77 DWORD cchNameMax, LPCWSTR wszPath);
78
79public:
80 CNewMenu();
81 ~CNewMenu();
82
83 // IObjectWithSite
84 virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite);
85 virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite);
86
87 // IContextMenu
88 virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
90 virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen);
91
92 // IContextMenu3
94
95 // IContextMenu2
97
98 // IShellExtInit
99 virtual HRESULT STDMETHODCALLTYPE Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID);
100
103
105
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)
113};
114
115#endif /* _SHV_ITEM_NEW_H_ */
const WCHAR ShellNewKey[]
Definition: CNewMenu.h:26
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
HRESULT SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL bRename)
Definition: CNewMenu.cpp:407
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu)
Definition: CNewMenu.cpp:317
HICON m_hIconFolder
Definition: CNewMenu.h:62
HRESULT NewItemByNonCommand(SHELLNEW_ITEM *pItem, LPWSTR wszName, DWORD cchNameMax, LPCWSTR wszPath)
Definition: CNewMenu.cpp:518
virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite)
Definition: CNewMenu.cpp:612
CNewMenu()
Definition: CNewMenu.cpp:28
virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
Definition: CNewMenu.cpp:665
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
virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: CNewMenu.cpp:700
virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
Definition: CNewMenu.cpp:625
virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite)
Definition: CNewMenu.cpp:618
UINT m_idCmdLink
Definition: CNewMenu.h:61
LPITEMIDLIST m_pidlFolder
Definition: CNewMenu.h:56
BOOL LoadCachedItems()
Definition: CNewMenu.cpp:242
void UnloadItem(SHELLNEW_ITEM *pItem)
Definition: CNewMenu.cpp:49
BOOL LoadAllItems()
Definition: CNewMenu.cpp:300
SHELLNEW_ITEM * m_pLinkItem
Definition: CNewMenu.h:58
HICON m_hIconLink
Definition: CNewMenu.h:62
HRESULT CreateNewItem(SHELLNEW_ITEM *pItem, LPCMINVOKECOMMANDINFO lpcmi)
Definition: CNewMenu.cpp:575
HMENU m_hSubMenu
Definition: CNewMenu.h:60
void UnloadAllItems()
Definition: CNewMenu.cpp:62
SHELLNEW_ITEM * LoadItem(LPCWSTR pwszExt)
Definition: CNewMenu.cpp:77
virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen)
Definition: CNewMenu.cpp:686
SHELLNEW_ITEM * m_pItems
Definition: CNewMenu.h:57
~CNewMenu()
Definition: CNewMenu.cpp:41
UINT m_idCmdFirst
Definition: CNewMenu.h:61
UINT m_idCmdFolder
Definition: CNewMenu.h:61
virtual HRESULT WINAPI HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
Definition: CNewMenu.cpp:707
HRESULT NewItemByCommand(SHELLNEW_ITEM *pItem, LPCWSTR wszPath)
Definition: CNewMenu.cpp:475
HRESULT CreateNewFolder(LPCMINVOKECOMMANDINFO lpici)
Definition: CNewMenu.cpp:446
SHELLNEW_ITEM * FindItemFromIdOffset(UINT IdOffset)
Definition: CNewMenu.cpp:385
BOOL CacheItems()
Definition: CNewMenu.cpp:170
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:542
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:562
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:640
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
#define DECLARE_REGISTRY_RESOURCEID(x)
Definition: atlcom.h:606
#define END_COM_MAP()
Definition: atlcom.h:553
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:60
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:866
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
#define WINAPI
Definition: msvc.h:6
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