Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ProgressBar with copyfile

Posted on 1998-12-12
7
Medium Priority
?
1,552 Views
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?
0
Comment
Question by:waipahu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 12

Expert Comment

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

Raymond
0
 
LVL 20

Expert Comment

by:Madshi
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.
0
 

Author Comment

by:waipahu
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????
thanks
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:Madshi
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.
0
 
LVL 1

Accepted Solution

by:
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                                        |
|                                                                              |
+------------------------------------------------------------------------------+

0
 
LVL 1

Expert Comment

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

Author Comment

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

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

604 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