Advertisement
C_Volume2 Windows API Call/ Explanation #74314

Copy Files Using Copy Progress Dialog

Copy a file the using SHFileOperation API call so that Windows copy progress dialog appears...

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Public Sub CopyFileWindowsWay(SourceFile As String, DestinationFile As String)
   Dim lngReturn As Long
   Dim typFileOperation As SHFILEOPSTRUCT
   With typFileOperation
    .hWnd = 0
    .wFunc = FO_COPY
    .pFrom = SourceFile & vbNullChar & vbNullChar 'source file
    .pTo = DestinationFile & vbNullChar & vbNullChar 'destination file
    .fFlags = FOF_ALLOWUNDO
   End With
   lngReturn = SHFileOperation(typFileOperation)
   If lngReturn <> 0 Then 'Operation failed
     MsgBox Err.LastDllError, vbCritical Or vbOKOnly
   Else 'Aborted
     If typFileOperation.fAnyOperationsAborted = True Then
        MsgBox "Operation Failed", vbCritical Or vbOKOnly
     End If
   End If
End Sub
Original Comments (3)
Recovered from Wayback Machine