ReactOS 0.4.16-dev-329-g9223134
CCopyMoveToMenu.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS shell32
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: CopyTo and MoveTo implementation
5 * COPYRIGHT: Copyright 2020-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7#pragma once
8
10 public CComObjectRootEx<CComMultiThreadModelNoCS>,
11 public IContextMenu2,
12 public IObjectWithSite,
13 public IShellExtInit
14{
15protected:
16 CComPtr<IDataObject> m_pDataObject;
17 CComPtr<IUnknown> m_pSite;
18
19 HRESULT DoRealFileOp(const CIDA *pCIDA, LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidlDestination);
21
22public:
23 CComHeapPtr<ITEMIDLIST> m_pidlFolder;
26
28
29 virtual UINT GetCaptionStringID() const = 0;
30 virtual UINT GetButtonStringID() const = 0;
31 virtual UINT GetActionTitleStringID() const = 0;
32 virtual UINT GetFileOp() const = 0;
33 virtual LPCSTR GetVerb() const = 0;
34 STDMETHODIMP QueryContextMenuImpl(BOOL IsCopyOp, HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
35
36 // IContextMenu
37 STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
39
40 // IContextMenu2
42
43 // IShellExtInit
44 STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
45
46 // IObjectWithSite
47 STDMETHODIMP SetSite(IUnknown *pUnkSite) override;
48 STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override;
49};
50
52 : public CComCoClass<CCopyToMenu, &CLSID_CopyToMenu>
53 , public CCopyMoveToMenu
54{
55public:
56 CComHeapPtr<ITEMIDLIST> m_pidlFolder;
59
61
62 // IContextMenu
63 STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
64
67
69
71 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
72 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
73 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
76
77 UINT GetCaptionStringID() const override { return IDS_COPYITEMS; }
78 UINT GetButtonStringID() const override { return IDS_COPYBUTTON; }
79 UINT GetActionTitleStringID() const override { return IDS_COPYTOTITLE; }
80 UINT GetFileOp() const override { return FO_COPY; }
81 LPCSTR GetVerb() const override { return "copyto"; }
82};
83
85 : public CComCoClass<CMoveToMenu, &CLSID_MoveToMenu>
86 , public CCopyMoveToMenu
87{
88public:
90
91 // IContextMenu
92 STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
93
96
98
100 COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
101 COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
102 COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
105
106 UINT GetCaptionStringID() const override { return IDS_MOVEITEMS; }
107 UINT GetButtonStringID() const override { return IDS_MOVEBUTTON; }
108 UINT GetActionTitleStringID() const override { return IDS_MOVETOTITLE; }
109 UINT GetFileOp() const override { return FO_MOVE; }
110 LPCSTR GetVerb() const override { return "moveto"; }
111};
#define STDMETHODIMP
Definition: basetyps.h:43
STDMETHODIMP QueryContextMenuImpl(BOOL IsCopyOp, HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags)
HRESULT DoAction(LPCMINVOKECOMMANDINFO lpici)
virtual UINT GetCaptionStringID() const =0
CComHeapPtr< ITEMIDLIST > m_pidlFolder
HRESULT DoRealFileOp(const CIDA *pCIDA, LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidlDestination)
virtual UINT GetActionTitleStringID() const =0
virtual UINT GetButtonStringID() const =0
STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override
virtual UINT GetFileOp() const =0
STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
CComPtr< IDataObject > m_pDataObject
STDMETHODIMP SetSite(IUnknown *pUnkSite) override
STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
CComPtr< IUnknown > m_pSite
virtual LPCSTR GetVerb() const =0
WNDPROC m_fnOldWndProc
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
UINT GetButtonStringID() const override
UINT GetFileOp() const override
BOOL m_bIgnoreTextBoxChange
CComHeapPtr< ITEMIDLIST > m_pidlFolder
UINT GetCaptionStringID() const override
UINT GetActionTitleStringID() const override
LPCSTR GetVerb() const override
WNDPROC m_fnOldWndProc
LPCSTR GetVerb() const override
UINT GetFileOp() const override
UINT GetCaptionStringID() const override
STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
UINT GetButtonStringID() const override
UINT GetActionTitleStringID() const override
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
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
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 REFIID
Definition: guiddef.h:118
#define FO_COPY
Definition: shellapi.h:138
#define FO_MOVE
Definition: shellapi.h:137
#define IDS_MOVEITEMS
Definition: shresdef.h:349
#define IDS_MOVEBUTTON
Definition: shresdef.h:350
#define IDS_COPYBUTTON
Definition: shresdef.h:346
#define IDR_MOVETOMENU
Definition: shresdef.h:915
#define IDS_COPYITEMS
Definition: shresdef.h:345
#define IDR_COPYTOMENU
Definition: shresdef.h:914
#define IDS_MOVETOTITLE
Definition: shresdef.h:348
#define IDS_COPYTOTITLE
Definition: shresdef.h:344
const ITEMIDLIST_ABSOLUTE UNALIGNED * PCUIDLIST_ABSOLUTE
Definition: shtypes.idl:63
Definition: shlobj.h:572
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
static void Initialize()
Definition: xlate.c:212
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182