-
November 28th, 2010, 07:11 AM
#1
How to update progress bar from CopyFileEx function
Hi,
i am using CopyFileEx function to copy a large file. I need to display progress bar to give update to the user.
I have written the following callback function:
Code:
DWORD CALLBACK CopyProgressRoutine(LARGE_INTEGER TotalFileSize,
LARGE_INTEGER TotalBytesTransferred,
LARGE_INTEGER StreamSize,
LARGE_INTEGER StreamBytesTransferred,
DWORD dwStreamNumber,
DWORD dwCallbackReason,
HANDLE hSourceFile,
HANDLE hDestinationFile,
LPVOID lpData)
{
long lTotalSize = (TotalBytesTransferred.QuadPart / TotalFileSize.QuadPart * 100);
//m_FileCopyProgress.SetPos(lTotalSize);
return PROGRESS_CONTINUE;
}
How can i update the progress bar in a dialog from the above callback function.
Please advice.
Thanks in advance,
John.
-
November 28th, 2010, 08:11 AM
#2
Re: How to update progress bar from CopyFileEx function
When you call CopyFileEx from the dialog class, pass dialog handle as lpData parameter. Now CopyProgressRoutine gets this handle through its lpData. Post user-defined message to this handle, with lTotalSize in WPARAM. In the dialog, handle this message and set progressbar value.
-
November 28th, 2010, 02:13 PM
#3
Re: How to update progress bar from CopyFileEx function
Perfect.. Thank you. Reps added
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|