Wednesday, 21 August 2013

IFileOperation::DeleteItems doesn't ask for confirmation on Windows 8

IFileOperation::DeleteItems doesn't ask for confirmation on Windows 8

I'm experimenting with deleting files on Windows with
IFileOperation::DeleteItems. On Windows 7, when I invoke
IFileOperation::PerformOperations` I get a question asking whether I want
to delete the files first. But on Windows 8 it doesn't ask for a
confirmation and just moves files to trash.
Here's the code:
result = iOperation->DeleteItems(iArray);
if (SUCCEEDED(result))
{
result = iOperation->SetOperationFlags(FOF_ALLOWUNDO);
assert(SUCCEEDED(result));
result = iOperation->SetOwnerWindow((HWND)parentWindow);
assert(SUCCEEDED(result));
result = iOperation->PerformOperations();
}
I've also tried SetOperationFlags(FOF_ALLOWUNDO | FOFX_RECYCLEONDELETE); -
the effect seems to be the same.
If I request file to be deleted irrevocably instead of being moved to
trash (SetOperationFlags(FOF_WANTNUKEWARNING);) I get a prompt just in
Windows 7.
How can I get deletion prompt on Windows 8?

No comments:

Post a Comment