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


Mapping progress of CopyFile to a Progress Control

Posted on 2004-10-27
Medium Priority
Last Modified: 2013-11-20
An MFC Dialog button in my installation code starts a copy of some large files via CopyFile() and I'd like to show the progress of the copy in a Progress bar.  Does CopyFile() or the system provide a variable I can map to the Progress Control?

Thanks for any help.
Question by:steva
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 200 total points
ID: 12428697
LVL 86

Assisted Solution

jkr earned 200 total points
ID: 12429060
Or, use 'SHFileOperation()' instead, it comes with its own progress:

void CopyFileWithProgress ( char* pszDst, char* pszSrc) {


ZeroMemory ( &sfo, sizeof ( sfo));

sfo.pFrom = pszSrc;
sfo.fTo = pszDst;
sfo.wFunc = FO_COPY;
sfo.lpszProgressTitle = "Copying your file...";

SHFileOperation ( &sfo);

You can even do a wildcard copy (e.g. "*.cpp") with that.

Accepted Solution

Amritpal Singh earned 200 total points
ID: 12430970
look at the progress bars section at this ink


Author Comment

ID: 12437052
I tried using the SHFileOperation() routine but found it flakey. It wouldn't recognize the source file on the floppy if I specified a label in sfo.lpszProgressTitle, and sometimes hit an access error during the copy.  CopyFile(), on the other hand, works everytime with no problems.  I just don't trust SHFileOperation() enough to use it.

All three comments were great, though,  and helped me through this so I spit the points.

Thanks for your help.


Featured Post

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.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

577 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