Solved

CopyProgressRoutine in CopyFileEx. How?

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

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

Suggested Solutions

Title # Comments Views Activity
substring method in java 1 142
isEverywhere  challenge 19 91
has77  challenge 9 104
Example code 13 43
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.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

738 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