[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Mapping progress of CopyFile to a Progress Control

Posted on 2004-10-27
4
Medium Priority
?
568 Views
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.
Steve
0
Comment
Question by:steva
[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
4 Comments
 
LVL 55

Assisted Solution

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

Assisted Solution

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

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

SHFILEOPSTRUCT sfo;

ZeroMemory ( &sfo, sizeof ( sfo));

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

SHFileOperation ( &sfo);
}

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

Accepted Solution

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

http://rossm.net/Electronics/Computers/Software/C++/MFC.htm
0
 

Author Comment

by:steva
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.

Steve
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

649 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