Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


ProgressBar with copyfile

Posted on 1998-12-12
Medium Priority
Last Modified: 2008-03-10
I want to use a progressbar with the copyfile function.
I want to let users know the progress of copying a file.
How would I do this?
Question by:waipahu
  • 2
  • 2
  • 2
  • +1
LVL 12

Expert Comment

ID: 1350780
You would be better to use SHFileOperation - this has support for the progress bar display all built in.

LVL 20

Expert Comment

ID: 1350781
Raymond is right. But if you need it for winNT only, you can use the API CopyFileEx. It's a little bit easier than the SHFileOperation, I think.

Regards... Madshi.

Author Comment

ID: 1350782
What is SHFIleOperation? Sorry, new to delphi.
Can you give me a sample code?
Do you  mean i have to do a readblock and writeblock????
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 20

Expert Comment

ID: 1350783
SHFileOperation is win32API. You'll find the documention in the win32.hlp file. Just write SHFileOperation into your editor and press F1.

Regards... Madshi.

Accepted Solution

venks earned 30 total points
ID: 1350784
Dear waipahu
Look at the help file of TFileOperation Component Version 1 which encapsulates SHfileoperation of win32 API.You can downlaod the component from

URL: http://www.chez.com/herveroz 

Help file of the component
| TFileOperation Component Version 1.0                                         |
| Author: Hervé Roz                                                            |
| e-mail: hroz@chez.com                                                        |
| Description:                                                                 |
|   This component encapsulates the ShFileOperation API of Microsoft Windows.  |
| Performs a copy, move, rename, or delete operation on a file system object.  |
| Properties:                                                                  |
|   Source: String that contains the names of the source files, wildcard       |
|           filename (*.*) is accepted.                                        |
|           You can include several mask separeted by a ';'.                   |                                       |
|   Destination: String that specifies the destination for the moved, copied,  |
|                 or renamed file.                                             |
|   Mode:                                                                      |
|    -foCopy      Copies the files specified by pFrom to the location            |
|               specified by pTo.                                              |
|    -foDelete      Deletes the files specified by pFrom (pTo is ignored).         |
|    -foMove      Moves the files specified by pFrom to the location             |
|               specified by pTo.                                              |
|    -foRename      Renames the files specified by pFrom.                          |
|   Options:                                                                   |
|    -fofAllowUndo         Preserves undo information, if possible.            |
|    -fofConfirmMouse         Not implemented.                                    |
|    -fofFilesOnly         Performs the operation only on files if a wildcard  |
|                          filename (*.*) is specified.                        |
|    -fofMultiDestFiles    Indicates that the pTo member specifies multiple    |
|                          destination files (one for each source file) rather |
|                          than one directory where all source files are       |
|                          to be deposited.                                    |
|    -fofNoConfirmation    Responds with "yes to all" for any dialog box that  |
|                          is displayed.                                       |
|    -fofNoConfirmMkDir    Does not confirm the creation of a new directory    |
|                          if the operation requires one to be created.        |
|    -fofRenameOnCollision Gives the file being operated on a new name         |
|                          (such as "Copy #1 of...") in a move, copy,          |
|                          or rename operation if a file of the target name    |
|                          already exists.                                     |
|    -fofSilent            Does not display a progress dialog box.             |
|    -fofSimpleProgress    Displays a progress dialog box, but does not show   |
|                          the filenames.                                      |
|    -fofWantMappingHandle Not implemented.                                    |
|   Title: String to use as the title for a progress dialog box.               |
|          This member is used only if Options includes fofSimpleProgress.     |
|   AbortByUser: Value that receives True if the user aborted any file         |
|                operations before they were completed or FALSE otherwise.     |
|                                                                              |
| (*): Read only property                                                      |
| Methods:                                                                     |
|   function Execute: Performs the copy, move, rename, or delete operation.    |
|     Returns zero if successful or nonzero value if an error occurs.          |
| Events:                                                                      |

| Installation                                                                 |
| 1. Unzip the file to any directory you like, for instance                    |
|   C:\Delphi 3\Source\FileOper, ...                                           |
| 2. Start Delphi and close any projects and/or files                          |
| 3. From the menu, choose 'Components/Install Components...'                  |
| 4. In the dialog, click 'Browse'                                             |
| 5. Navigate to your chosen directory and select 'FileOper.pas'               |
| 6. Click OK the way back                                                     |
| 7. In the dialog you have now set the unit file                              |
| 8. Click OK to perform the install                                           |

| ******************************* IMPORTANT ********************************** |
|     This software is absolutely free. Use it and enjoy Delphi.               |
|     All I want is to know why and how you are using this                     |
|     software.                                                                |
|                                                                              |
|     Suggestions for improvement and fixes are always welcome,                |
|     although no guarantee is made when we'll implemement them.               |
|                                                                              |
|     If you do use this component, please drop me an email                    |
|     telling me how you used it.                                              |
|                                                                              |
|     For bug reports, suggestions, new versions etc. contact me:              |
|                                                                              |
|     e-mail: hroz@chez.com                                                    |
|     URL: http://www.chez.com/herveroz                                        |
|                                                                              |


Expert Comment

ID: 1350785
Dear waipahu
Either accept the answer or reject it.But do something

Author Comment

ID: 1350786
Sorry, been busy...
I'll try your recommendation...
Thanks again!


Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

575 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question