The CopyProgressRoutine function is an application-defined callback function used with the CopyFileEx function. It is called when a portion of a copy operation is completed. The LPPROGRESS_ROUTINE type defines a pointer to this callback function. CopyProgresRoutine is a placeholder for the application-defined function name.
DWORD CALLBACK CopyProgressRoutine(
LARGE_INTEGER TotalFileSize, // total file size, in bytes
LARGE_INTEGER TotalBytesTransferred,
// total number of bytes transferred
LARGE_INTEGER StreamSize, // total number of bytes for this stream
LARGE_INTEGER StreamBytesTransferred,
// total number of bytes transferred for
// this stream
DWORD dwStreamNumber, // the current stream
DWORD dwCallbackReason, // reason for callback
HANDLE hSourceFile, // handle to the source file
HANDLE hDestinationFile, // handle to the destination file
LPVOID lpData // passed by CopyFileEx
);
Value | Meaning |
---|---|
CALLBACK_CHUNK_FINISHED | Another part of the data file was copied. |
CALLBACK_STREAM_SWITCH | Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked. |
The CopyProgressRoutine function should return one of the following values:
Value | Meaning |
---|---|
PROGRESS_CONTINUE | Continue the copy operation. |
PROGRESS_CANCEL | Cancel the copy operation and delete the destination file. |
PROGRESS_STOP | Stop the copy operation. It can be restarted at a later time. |
PROGRESS_QUIET | Continue the copy operation, but stop invoking CopyProgressRoutine to report progress. |
An application can use this information to display a progress bar that shows the total number of bytes copied as a percent of the total file size.
Windows NT: Requires version 4.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: User-defined.
File I/O Overview, File Functions, CopyFileEx