WinApi ShellExecuteEx - 在文件列表中使用动词'copy' [英] WinApi ShellExecuteEx - using verb 'copy' on a file list

查看:171
本文介绍了WinApi ShellExecuteEx - 在文件列表中使用动词'copy'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用ShellExecuteEx复制或剪切给定目录中的一组文件? Windows功能在单个文件上正常工作,但我找不到任何提示的主题(与文件列表)。



我不期望任何替代方法(例如xcopy),因为在执行shell-item特定的操作后,我需要windows shell函数undo / redo。



。我试图填充'lpfile'参数与项目,如PChar(驱动器:\file1.fileExt,驱动器:\file1.fileExt)和其他这样的通用列表格式的列表...但是无关,shellExecuteEx返回值< 33。



是否有select或addtoselection等动词?
是否应该添加标志SEE_MASK_IDLIST,在这种情况下是一个ITEMIDLIST结构
能够定义将执行ShellExecuteEx动词的文件列表?

解决方案

是的,它可能的,但为什么执行外部命令如果Windows API有内置的函数呢?对于复制/剪切操作,我建议您使用 SHFileOperation( ),Microsoft提供了代码示例



或者,您也可以使用 CopyFileEx()复制文件,并使用 MoveFile()移动文件。它们比 SHFileOperation()更快。 / p>

is it possible to use ShellExecuteEx to copy or cut a group of files in a given directory ? The Windows function works fine on a single file but I can't find anywhere any tips over the subject (with a file list).

I don't expect any alternative method ( such as xcopy) because I need the windows shell function undo/redo after performing shell-item-specific actions.

It's not documented at all in the microsoft msdn library. I've tried to fill the 'lpfile' parameter with a list of items such as PChar("Drive:\file1.fileExt","Drive:\file1.fileExt") and other such common list format... but nothing to do, shellExecuteEx return a value < 33.

Is there a verb such as 'select' or 'addtoselection' ? Should the flag SEE_MASK_IDLIST be added and in this case is an ITEMIDLIST Structure able to define a file list on which the ShellExecuteEx verb will be executed ?

解决方案

Yes, its possible, but why execute external command if Windows API has built-in functions to do that? For copy/cut operation, I recommend you to use SHFileOperation(), Microsoft has provided a code example for that purpose.

Alternatively, you can also use CopyFileEx() to copy files, and use MoveFile() to move files. They are faster than SHFileOperation().

这篇关于WinApi ShellExecuteEx - 在文件列表中使用动词'copy'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆