Solved

CopyProgressRoutine in CopyFileEx. How?

Posted on 1998-06-29
1
1,133 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 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