简体   繁体   中英

CopyFileEx with multiple files, but only one copy dialog

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 eg 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.

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.

OpenFileDialogMultiSelect属性设置为true。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM