2022-09-09 17:44:50 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "pch.h"
|
|
|
|
|
2022-09-12 18:41:59 +08:00
|
|
|
#define EXPLORER_COMMAND_UUID_STR "84d68575-e186-46ad-b0cb-baeb45ee29c0"
|
|
|
|
|
2022-09-12 21:29:19 +08:00
|
|
|
class __declspec(uuid(EXPLORER_COMMAND_UUID_STR)) ExplorerCommand : public IExplorerCommand, public IShellExtInit, public IContextMenu
|
2022-09-09 17:44:50 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// IUnknown
|
2022-09-09 20:44:40 +08:00
|
|
|
IFACEMETHODIMP QueryInterface(REFIID riid, void** ppv) override;
|
|
|
|
IFACEMETHODIMP_(ULONG) AddRef() override;
|
|
|
|
IFACEMETHODIMP_(ULONG) Release() override;
|
2022-09-09 17:44:50 +08:00
|
|
|
|
|
|
|
// IExplorerCommand
|
|
|
|
IFACEMETHODIMP GetTitle(IShellItemArray* psiItemArray, LPWSTR* ppszName) override;
|
|
|
|
IFACEMETHODIMP GetIcon(IShellItemArray* psiItemArray, LPWSTR* ppszIcon) override;
|
|
|
|
IFACEMETHODIMP GetToolTip(IShellItemArray* psiItemArray, LPWSTR* ppszInfotip) override;
|
|
|
|
IFACEMETHODIMP GetCanonicalName(GUID* pguidCommandName) override;
|
|
|
|
IFACEMETHODIMP GetState(IShellItemArray* psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE* pCmdState) override;
|
|
|
|
IFACEMETHODIMP Invoke(IShellItemArray* psiItemArray, IBindCtx* pbc) override;
|
|
|
|
IFACEMETHODIMP GetFlags(EXPCMDFLAGS* pFlags) override;
|
|
|
|
IFACEMETHODIMP EnumSubCommands(IEnumExplorerCommand** ppEnum) override;
|
2022-09-09 20:44:40 +08:00
|
|
|
|
2022-09-12 21:08:37 +08:00
|
|
|
// IShellExtInit
|
|
|
|
IFACEMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject* pdtobj, HKEY hkeyProgID) override;
|
|
|
|
|
2022-09-12 21:29:19 +08:00
|
|
|
// IContextMenu
|
|
|
|
IFACEMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
|
|
|
|
IFACEMETHODIMP InvokeCommand(CMINVOKECOMMANDINFO* pici) override;
|
|
|
|
IFACEMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType, UINT* pReserved, CHAR* pszName, UINT cchMax) override;
|
2022-09-12 21:08:37 +08:00
|
|
|
|
2022-09-09 20:44:40 +08:00
|
|
|
// Static member to create an instance
|
|
|
|
static HRESULT s_CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject);
|
2022-09-12 21:08:37 +08:00
|
|
|
|
|
|
|
// Destructor
|
|
|
|
~ExplorerCommand();
|
|
|
|
|
2022-09-09 17:44:50 +08:00
|
|
|
private:
|
2022-09-12 21:29:19 +08:00
|
|
|
std::atomic<ULONG> m_ref_count = 1;
|
|
|
|
IDataObject* m_data_obj = NULL;
|
2022-09-09 17:44:50 +08:00
|
|
|
};
|