Solved

CopyProgressRoutine in CopyFileEx. How?

Posted on 1998-06-29
1
1,111 Views
Last Modified: 2013-11-20
I need to know how to use the LPPROGRESS_ROUTINE argument of the CopyFileEx function.
1. How to call the function:
if( !CopyFileEx( file1_ptr,file2_ptr,???,NULL,&stop,COPY_FILE_FAIL_IF_EXISTS
 ) )
2. How to declare the Callback function in some class:
DWORD WINAPI MyClass::CopyProgressRoutine(...args..)
{
   return PROGRESS_CONTINUE;
}
Help please. Thanks.
0
Comment
Question by:wau
1 Comment
 
LVL 2

Accepted Solution

by:
rayb earned 50 total points
Comment Utility
If you must have the callback as a member function to a class, you must declare that member as static.

Like so:
      static DWORD WINAPI CopyProgressRoutine(LARGE_INTEGER TotalFileSize,
                                                                  LARGE_INTEGER TotalBytesTransferred,
                                                                  LARGE_INTEGER StreamSize,
                                                                  LARGE_INTEGER StreamBytesTransferred,
                                                                  DWORD dwStreamNumber,
                                                                  DWORD dwCallbackReason,
                                                                  HANDLE hSourceFile,
                                                                  HANDLE hDestinationFile,
                                                                  LPVOID lpData );


Then the API call becomes:

if( !CopyFileEx( file1_ptr,file2_ptr,CopyProgressRoutine,NULL,&stop,COPY_FILE_FAIL_IF_EXISTS
 ) )
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 73
method notes when mouse over in eclipse 5 67
scoreUp challenge 14 47
Problem to open Excel file 15 37
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now