1

Say, I have the "K:\test del USB" folder. Then I do the following:

SHFILEOPSTRUCT sfo = {0};
sfo.wFunc = FO_DELETE;
sfo.pFrom = L"K:\\test del USB\0";
sfo.fFlags = FOF_ALLOWUNDO |
     FOF_SILENT | /*FOF_NOCONFIRMATION |*/ FOF_NOERRORUI | FOF_NOCONFIRMMKDIR |
     FOF_WANTNUKEWARNING;

int res = SHFileOperation(&sfo);
BOOL bFullSuccess = res == 0 && !sfo.fAnyOperationsAborted;

So when I run it, the SHFileOperation API shows this warning:

Are you sure you want to permanently delete this folder?

enter image description here

If the end-user clicks "No", SHFileOperation return 0x4c7, which I believe is ERROR_CANCELLED.

My question is, if I don't need any UI, how can I know that my file/folder will be permanently deleted (vs. placed into the Recycle Bin)?

c00000fd
  • 20,994
  • 29
  • 177
  • 400

0 Answers0