Skip to content

Commit

Permalink
Fixed #100 - error message after canceling a deletion operation on Wi…
Browse files Browse the repository at this point in the history
…ndows
  • Loading branch information
VioletGiraffe committed Sep 17, 2024
1 parent c4115dc commit 9287118
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions file-commander-core/src/shell/cshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ RESTORE_COMPILER_WARNINGS
#include <Windows.h>
#endif

static constexpr HRESULT UserCancelledAltError = 0x800704c7L; // When you close the system dialog with the title bar X rather than the cancel button inside the dialog

std::pair<QString /* exe path */, QString /* args */> OsShell::shellExecutable()
{
#ifdef _WIN32
Expand Down Expand Up @@ -387,9 +389,9 @@ bool OsShell::deleteItems(const std::vector<std::wstring>& items, bool moveToTra
qInfo() << "SetOwnerWindow failed";

result = iOperation->PerformOperations();
if (!SUCCEEDED(result) && result != COPYENGINE_E_USER_CANCELLED)
if (!SUCCEEDED(result) && result != COPYENGINE_E_USER_CANCELLED && result != UserCancelledAltError)
{
qInfo() << "PerformOperations failed";
qInfo().nospace() << "PerformOperations failed with 0x" << Qt::hex << (uint32_t)result;
if (result == COPYENGINE_E_REQUIRES_ELEVATION)
qInfo() << "Elevation required";
}
Expand Down

0 comments on commit 9287118

Please sign in to comment.