CopyFileEx具有多个文件,但只有一个复制对话框 [英] CopyFileEx with multiple files, but only one copy dialog

查看:42
本文介绍了CopyFileEx具有多个文件,但只有一个复制对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在网上搜索了这个信息.

I've searched the web and stackoverflow for this.

我想将多个文件从多个来源复制到多个目的地.我现在还没有为UnauthorizedAccessExceptions烦恼-这些文件很可能仍未被使用.

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.

我可以从此处使用CopyFileEx-Wrapper复制1个文件.但是:我希望出现标准的Windows复制文件对话框.我想复制多个文件-不仅仅是一个-例如传递一组源文件和一组目标文件.

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.

有没有办法做到这一点?更进一步:有没有一种方法可以将此任务作为一个任务而不是x分开的复制操作排队?之所以这样,是因为我只想显示一个进度对话框-从开始到复制所有文件结束.

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.

非常感谢大家.

divStar.

推荐答案

是的,使用IFileOperation Shell接口可以实现此功能,该接口自Vista开始提供. MSDN杂志的2007年12月版中提供了用于此COM接口的托管类包装器.a>.

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.

该文章的标题为" .NET问题:Windows Vista中的IFileOperation "
该示例代码仍然可用这里.

The Article is titled ".NET Matters: IFileOperation in Windows Vista"
The sample code is still available here.

如果还需要在早期版本的Windows上运行,请回退现有代码.

Fall back on your existing code if it also needs to run on earlier versions of Windows.

这篇关于CopyFileEx具有多个文件,但只有一个复制对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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