Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making File Copy with a Progress Bar 1

Status
Not open for further replies.

burgdavid

Programmer
Jun 22, 2000
70
DE
Hello,<br><br>I would like to implemente file copy with a progress bar. In fact, under Windows NT 4 (and so, I suppose also under Windows 2000), it exists a cool (but complexe) function FileCopyEx which can call a CallBack function of our own.<br><br>Unfortunately, I need that my program works on both Windows 9x systems and Windows NT...<br><br>So I will prbably need to write my own copy function (absolutly not cool), and don't know exactly how to do this the best.<br><br>Note, that I want to have a progress bar that show progress for a single big file, and not a bar that show progress at every time a file copy is completed (during multiple file copy).<br><br>Note also that because FileCopyEx is a windows base function, I think it is not possible to stole the code of the function from source of MFC.<br><br>Any idea or good advise ?<br><br>David Burg.
 
Dear David,<br><br>Obviously you will need to know the total bytes of all the files in a multiple file scenario in order to make a single 1-100% progress bar for all of the files.<br><br>The actual copy is simple, the details of pathing and user interface are more complex. To perform a file copy make sure to open the files in binary mode and perform block IO.<br><br>If you want to optimize for speed that would require writing some code. Different hardware and different OS's will perform disk IO fastest at specific buffer sizes. You would need to perform sampling over a period of time and persist the restults for analysis to determine the optimal buffer size used in disk IO.<br><br>Hope this helps<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top