Is it possible to copy multiple files with a single dialog?

ikantspelwurdz

Well-known member
Joined
Dec 8, 2009
Messages
49
Programming Experience
1-3
I have code that looks like this:

VB.NET:
For Each curFile As FileInfo In fileInfoList
     My.Computer.FileSystem.CopyFile(curFile.FullName, destination, UIOption.AllDialogs, UICancelOption.ThrowException)
Next

This works, but it results in showing a series of Windows copy dialogs, each one responsible for a single file copy operation. In Windows, if you select multiple files and copy them, you will get a single dialog responsible for all of them. I want to have my code use that behavior. How can do this? It's not a problem if the source files must all come from the same directory.
 

Attachments

  • copymulti.png
    copymulti.png
    40.6 KB · Views: 36
Create your own dialog and do your copy with no UI, or use a mask instead of a filename, but you have a list of files so that probably won't work for you.
 
It is possible but there's no managed interface. That FileSystem.CopyFile method wraps the same shell function that Windows Explorer uses to copy a file with a progress dialogue. There is a similar shell function that Windows Explorer uses when you copy multiple files but the VB FileSystem object has no corresponding method. You can use PInvoke to call the unmanaged function and get the same UI though. I will see if I can find the details and post an example. I know that I've seen it before but don't have an example immediately to hand.
 
Back
Top