Hi all,
I'm wanting to copy a file using the CopyFileEx API command and update a progress bar using the CopyprogressRoutine that it calls (every 64k I've read).
Does anyone have a working code snippet for this API or can help by correcting my code below?
I've not used structures with procedure calls before. At present the debug code causes a "pointer is null" error.
I have found that changing the LARGE_INTEGER structures to long (.l) allows the code to run but after the final call to the copyprogress procedure the code loops with the processor at 99 percent until I quit.
Thx.

Insomniac
Procedure.l CopyProgress( *TotalFileSize.LARGE_INTEGER, *TotalBytesTransferred.LARGE_INTEGER, *StreamSize.LARGE_INTEGER, *StreamBytesTransferred.LARGE_INTEGER, dwStreamNumber.l, dwCallbackReason.l , hSourceFile.l , hDestinationFile.l , lpData.l )
; This procedure will be expanded to drive a progressbar gadget
Debug *TotalBytesTransferred\lowpart
Debug *TotalBytesTransferred\highpart
ProcedureReturn 0
EndProcedure
sourcefile.s = "c:\temp\a.txt"
destfile.s = "c:\temp\b.txt"
lpData.l = NULL ; Nothing to be passed To the callback function
pbCancel.l = #FALSE; flag that can be used To cancel the operation
dwCopyFlags.l = 0 ; flags that specify how the file is copied
MsgBuffer.s = Space(200)
Result = CopyFileEx_( @sourcefile, @destfile, @CopyProgress() , lpData, pbCancel, dwCopyFlags)
If result = 0
FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError_(), #LANG_NEUTRAL, @MsgBuffer, 200, 0)
MessageRequester("",MsgBuffer,#PB_MessageRequester_Ok)
Else
MessageRequester("demo","Success", #PB_MessageRequester_Ok )
EndIf