| 372 | |
| 373 | |
| 374 | HRESULT Invoke( IShellItemArray* selection, IBindCtx* ctx) noexcept |
| 375 | { |
| 376 | /* |
| 377 | if no files are selected, selection contains 1 element to the current invoked folder (Windows 11 only) |
| 378 | On Windows 10, `selection` is `nullptr` |
| 379 | */ |
| 380 | |
| 381 | auto hwnd = GetForegroundWindow(); |
| 382 | switch (m_op) |
| 383 | { |
| 384 | case CopyOperation::Copy: |
| 385 | case CopyOperation::Move: return recordFilesImpl(selection); |
| 386 | case CopyOperation::Paste: |
| 387 | { |
| 388 | |
| 389 | for (auto const& info : GetCurrentExplorerFolders()) |
| 390 | { |
| 391 | if (info.hwnd == hwnd) |
| 392 | { |
| 393 | TCHAR* ptr; |
| 394 | SHGetNameFromIDList(info.pidl.get(), SIGDN_FILESYSPATH, &ptr); |
| 395 | return callMainProgramImpl(ptr); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | ShellItem psi{ selection ? ShellItemArray{ selection }[0] : m_parent }; |
| 400 | return callMainProgramImpl(psi.GetDisplayName()); |
| 401 | } |
| 402 | case CopyOperation::Delete: |
| 403 | recordFilesImpl(selection); |
| 404 | return callMainProgramImpl(L""); |
| 405 | default: |
| 406 | assert(false); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | HRESULT GetFlags(EXPCMDFLAGS* flags) { *flags = ECF_DEFAULT; return S_OK; } |
| 411 | HRESULT EnumSubCommands(IEnumExplorerCommand** enumCommands) { *enumCommands = nullptr; return E_NOTIMPL; } |
nothing calls this directly
no test coverage detected