I use C++ Builder and SHFileOperation to download an application (its folder) from a network location. WinApi has its own progress bar but i need a custom form with a progress bar.
How can i track the copy progress alone so i can have my own progress bar? A short example will definetely help. thanks.
SHFileOperationdoes not offer you a means to receive progress callbacks. You can either accept the progress feedback dialog provided by the system, or do without any progress reporting at all.There is
CopyFileExwhich supports progress callbacks. But that only caters for copying a single file and not an entire directory.On Vista and later there is
IFileOperationwhich is the replacement forSHFileOperation. This interface is more capable thanSHFileOperation. You can useIFileOperationto copy entire directories, and receive progress notification.If you need to support XP or earlier then you would need to write your own directory copy routine. You would have to calculate the total size of files to be copied, and then perform each individual file copy with
CopyFileEx. You'd receive progress callbacks fromCopyFileExand then turn them into overall progress events for your application to display.