CopyFileEx 具有多个文件,但只有一个复制对话框
我已经在网络和 stackoverflow 上搜索过这个。
我想将多个文件从多个源复制到多个目标。我还没有为 UnauthorizedAccessExceptions 烦恼 - 这些文件很可能无论如何都不会被使用。
我可以使用 CopyFileEx-Wrapper 从此处复制 1 个文件。但是:我希望出现标准的 Windows 复制文件对话框。我想通过传递一组源文件和一组目标文件来复制多个文件 - 而不仅仅是一个文件。
有办法做到这一点吗?此外:有没有一种方法可以将其作为一个任务排队,而不是 x 个分隔的复制操作?原因是我只想显示一个进度对话框 - 从复制所有文件的开始到结束。
我希望我的问题很清楚。
提前非常感谢大家。
明星。
I've searched the web and stackoverflow for this.
I want to copy multiple files from multiple sources to multiple destinations. I don't bother with UnauthorizedAccessExceptions yet - the files are most likely to not be in use anyway.
I can copy 1 file using CopyFileEx-Wrapper from here. However: I'd like the standard windows copy file dialog to appear. And I'd like to copy multiple files - not just one - by e.g. passing an array of source files and an array of destination files.
Is there a way to do this? Further more: is there a way to queue this as one task and not x separated copy operations? The reason for this is the fact that I'd like to display only one progressing dialog - from the start till the end of copying all files.
I hope my question is clear.
Thank you all very much in advance.
divStar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,这可以通过自 Vista 起提供的 IFileOperation shell 接口实现。此 COM 接口的托管类包装器可在 2007 年 12 月号的 MSDN 杂志。
文章标题为“.NET 问题:Windows Vista 中的 IFileOperation”
示例代码仍然可用 在这里。
如果现有代码还需要在早期版本的 Windows 上运行,则可以使用现有代码。
Yes, this is possible with the IFileOperation shell interface, available since Vista. A managed class wrapper for this COM interface is available in the December 2007 issue of MSDN Magazine.
The Article is titled ".NET Matters: IFileOperation in Windows Vista"
The sample code is still available here.
Fall back on your existing code if it also needs to run on earlier versions of Windows.
设置
MultiSelect
OpenFileDialog< 的属性/code>
为 true。
Set the
MultiSelect
property of yourOpenFileDialog
to true.