CopyFileEx 具有多个文件,但只有一个复制对话框

发布于 2024-09-06 18:52:38 字数 468 浏览 12 评论 0原文

我已经在网络和 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

思慕 2024-09-13 18:52:38

是的,这可以通过自 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.

生生漫 2024-09-13 18:52:38

Set the MultiSelect property of your OpenFileDialog to true.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文