Jump to content

Recommended Posts

Posted

zFrank

Try this:

Global Const $PROGRESS_CONTINUE = 0
Global Const $PROGRESS_CANCEL   = 1
Global Const $PROGRESS_STOP     = 2
Global Const $PROGRESS_QUIET    = 3

_FileCopyEx("d:\Video\Clips\New\02.avi", "c:\02.avi")

Func _FileCopyEx($Source, $Dest)
    If Not FileExists($Source) Then Return SetError(1, 0, 0)
    
    ProgressOn("_FileCopyEx() Demo", "Copy, please wait...")
    
    $pCopyProgressRoutine = DllCallbackRegister("_CopyProgressRoutine", "int", "uint64;uint64;uint64;uint64;dword;dword;ptr;ptr;ptr")
    
    DllCall("kernel32.dll", "int", "CopyFileEx", _
        "str", $Source, _
        "str", $Dest, _
        "ptr", DllCallbackGetPtr($pCopyProgressRoutine), _
        "ptr", 0, _
        "int", 0, _
        "int", 0)
    
    DllCallbackFree($pCopyProgressRoutine)
    Sleep(1000)
    ProgressOff()
EndFunc

Func _CopyProgressRoutine($TotalFileSize, $TotalBytesTransferred, $StreamSize, $StreamBytesTransferred, $dwStreamNumber, $dwCallbackReason, $hSourceFile, $hDestinationFile, $lpData)
    $Percent = $TotalBytesTransferred / $TotalFileSize * 100
    
    ProgressSet($Percent, "Percent: " & Round($Percent, 1) & "%")
    
    Return $PROGRESS_CONTINUE
EndFunc   ;==>_CopyProgressRoutine

MSDN:

CopyFileEx

CopyProgressRoutine

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...