如何从文件名列表中创建IShellItemArray ?

时间:2022-07-05 09:57:32

could you please tell me how to delete multiple files with IFileOperation::DeleteItems? I'm not able to build IShellItemArray with file names. Thank you!

你能告诉我如何用IFileOperation删除多个文件::DeleteItems?我无法用文件名构建IShellItemArray。谢谢你!

2 个解决方案

#1


2  

You can use SHCreateShellItemArrayFromIDLists

您可以使用SHCreateShellItemArrayFromIDLists

#2


1  

I got around this same problem. I created a variable (to hold all my IShellItems) of type vector and converted each filename ( also of a vector) using a for loop into an IShellItem object and kept them in the IShellItem container. Then I loop through this IShellItem container, supplying each item to CopyItem(). After the loop, I then called PerformOpeations().

我遇到了同样的问题。我创建了一个变量(保存所有的IShellItems),并将每个文件名(也包括一个矢量)转换为IShellItem对象,并将它们保存在IShellItem容器中。然后我遍历这个IShellItem容器,向CopyItem()提供每个条目。在循环之后,我调用PerformOpeations()。

#1


2  

You can use SHCreateShellItemArrayFromIDLists

您可以使用SHCreateShellItemArrayFromIDLists

#2


1  

I got around this same problem. I created a variable (to hold all my IShellItems) of type vector and converted each filename ( also of a vector) using a for loop into an IShellItem object and kept them in the IShellItem container. Then I loop through this IShellItem container, supplying each item to CopyItem(). After the loop, I then called PerformOpeations().

我遇到了同样的问题。我创建了一个变量(保存所有的IShellItems),并将每个文件名(也包括一个矢量)转换为IShellItem对象,并将它们保存在IShellItem容器中。然后我遍历这个IShellItem容器,向CopyItem()提供每个条目。在循环之后,我调用PerformOpeations()。