I have a file that I can reach by pidl via IShellFolder. This file has the flag SFGAO_CANDELETE and its parent folder has the flag SFGAO_STORAGEANCESTOR only.
How can I delete the file?
Conditions:
- Files and folders are on USB device (digital camera and a phone).
- A solution should work at least on WinXP (Win2000 support would be wonderful)
- With no using of WPD.
I tried calling SHFileOperation on the pidl, but it requires a file-system path, not the GUID-style path I have. I asked about this on Experts Exchange, where I learned about IFileOperation, but that requires Windows Vista.
Sample:
parent folder::
media ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_04e8&pid_6860&ms_comp_mtp&samsung_android#7&69f3c26&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,SECZ9519043CHOHB,12351995904}\{0000000C-0000-0000-0000-000000000000}
SFGAO_CANCOPY
SFGAO_CANMOVE
SFGAO_CANRENAME
SFGAO_CANDELETE
SFGAO_HASPROPSHEET
SFGAO_DROPTARGET
SFGAO_STORAGEANCESTOR
SFGAO_FOLDER
SFGAO_HASSUBFOLDER
SFGAO_CONTENTSMASK
file to delete:
some breathing.mp3 ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\\?\usb#vid_04e8&pid_6860&ms_comp_mtp&samsung_android#7&69f3c26&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,SECZ9519043CHOHB,12351995904}\{0000000C-0000-0000-0000-000000000000}\{0000001B-0000-0000-0000-000000000000}\{0000001C-0000-0000-0000-000000000000}\{00000021-0000-0000-0000-000000000000}
SFGAO_CANCOPY
SFGAO_CANMOVE
SFGAO_CANRENAME
SFGAO_CANDELETE
SFGAO_HASPROPSHEET
SFGAO_DROPTARGET
SFGAO_STREAM
See the answer I posted to this very same question (from you?) on the C++Builder Journal forums last month. In short, the only documented way I can find anywhere is to retreive the parent folder’s
IContextMenuinterface, and then invoke thedeleteverb on the desired file.