Solved

CopyProgressRoutine in CopyFileEx. How?

Posted on 1998-06-29
1
1,122 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
ID: 1318507
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Importing  SSL Certificate into Firefox using GPO 28 202
How to calculate times for developing software? 8 65
deburging in oracle form 12 88
sameEnds challenge 3 133
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

919 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

21 Experts available now in Live!

Get 1:1 Help Now