On Oct 11, 5:42*pm, "Johnny Jörgensen" <j...@altcom.sewrote:
Using File.Copy in the System.IO namespace, it's easy to copy one or more
files.
But I wonder: Is it possible to get windows to display its File Copy
Progress dialog at the same time - or alternatively get callbacks with the
progress?
Same goes for deleting files...
Cheers,
Johnny J.
Yes, using P/Invoke with SHFileOperation API is the long and risky way
to write the whole code error-free, that's why My namespace in VB.NET
provides a well-wrapper for this:
My.Computer.FileSystem.CopyFile("source","dest", _
True,FileIO.UICancelOption.DoNothing)
The third parameter, which is "showUI", lets you to view native dialog
while copying is in progress.
http://msdn.microsoft.com/en-us/libr...yf(VS.80).aspx
Though yours is cross-post, you can call the same function in C# by
referencing it to Microsoft.VisualBasic.dll from .NET tab in "Add
Reference" menu with the following code:
using Microsoft.VisualBasic.Devices;
Computer copyfile = new Computer();
//Pass parameters below including showUI
copyfile.FileSystem.CopyFile(...);
Hope this helps,
Onur Güzel