开发者

How can I delete an object flagged as SFGAO_STREAM?

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:

  1. Files and folders are on USB device (digital camera and a phone).
  2. A s开发者_C百科olution should work at least on WinXP (Win2000 support would be wonderful)
  3. 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 IContextMenu interface, and then invoke the delete verb on the desired file.


Using the IContextMenu is completely bad idea, despite it could do work.

It is similar that when you want a cup of coffee you should call a man that comes into your home and do it for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜