mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-01 09:59:06 +08:00
Implemented IExplorerCommand methods
This commit is contained in:
parent
88aa85e365
commit
f65958b212
10
tools/HandlesExperiment/ContextMenuEntry/Constants.h
Normal file
10
tools/HandlesExperiment/ContextMenuEntry/Constants.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// Localizable Constants, these should be converted to resources
|
||||
namespace constants::localizable
|
||||
{
|
||||
// Text shown in the context menu
|
||||
constexpr WCHAR CommandTitle[] = L"What's using this file?";
|
||||
}
|
@ -135,6 +135,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Constants.h" />
|
||||
<ClInclude Include="ExplorerCommand.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
|
@ -21,6 +21,9 @@
|
||||
<ClInclude Include="ExplorerCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Constants.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "ExplorerCommand.h"
|
||||
#include "Constants.h"
|
||||
|
||||
// Implementations of inherited IUnknown methods
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::QueryInterface(REFIID riid, void** ppv)
|
||||
{
|
||||
@ -25,3 +28,57 @@ IFACEMETHODIMP_(ULONG) ExplorerCommand::Release()
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Implementations of inherited IExplorerCommand methods
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetTitle(IShellItemArray* psiItemArray, LPWSTR* ppszName)
|
||||
{
|
||||
return SHStrDup(constants::localizable::CommandTitle, ppszName);
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetIcon(IShellItemArray* psiItemArray, LPWSTR* ppszIcon)
|
||||
{
|
||||
// Path to the icon should be computed relative to the path of this module
|
||||
ppszIcon = NULL;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetToolTip(IShellItemArray* psiItemArray, LPWSTR* ppszInfotip)
|
||||
{
|
||||
// No tooltip for now
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetCanonicalName(GUID* pguidCommandName)
|
||||
{
|
||||
*pguidCommandName = __uuidof(this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetState(IShellItemArray* psiItemArray, BOOL fOkToBeSlow, EXPCMDSTATE* pCmdState)
|
||||
{
|
||||
// This should depend on the settings
|
||||
// For now we'll just keep it always enabled.
|
||||
*pCmdState = ECS_ENABLED;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::Invoke(IShellItemArray* psiItemArray, IBindCtx* pbc)
|
||||
{
|
||||
// This should call the main exe.
|
||||
// For now we'll just show a message box.
|
||||
MessageBoxW(NULL, L"OK", L"OK", MB_OK);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::GetFlags(EXPCMDFLAGS* pFlags)
|
||||
{
|
||||
*pFlags = ECF_DEFAULT;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP ExplorerCommand::EnumSubCommands(IEnumExplorerCommand** ppEnum)
|
||||
{
|
||||
*ppEnum = NULL;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user