Solved

CopyProgressRoutine in CopyFileEx. How?

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

740 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