Windows API help with CopyFileExA() and Callback to show Progress

I’m running out, suggest look at SHFileOperationA that will show its own Progress Window using FOF_SIMPLEPROGRESS. I thnik you can pass Wnd Hnd as Zero.

Here are some translations. These are partly automated and not tested. You have to read MSDN for details.

SHFileOperation    PROCEDURE(       |    !int SHFileOperationA(
      LONG AddressLPSHFILEOPSTRUCTA |    !inout LPSHFILEOPSTRUCTA lpFileOp
    ),SIGNED ,RAW,PASCAL,DLL(1),PROC,name('SHFileOperationA')

SHFILEOPSTRUCTAtype GROUP,TYPE !,PRE()    !typedef struct _SHFILEOPSTRUCTA {
hwnd                      SIGNED               !HWND hwnd
wFunc                     UNSIGNED             !UINT wFunc
pFrom_PCZZSTR_Addr        LONG                 !PCZZSTR pFrom Address of File Name(s) String(s) Double Null Term
pTo_PCZZSTR_Addr          LONG                 !PCZZSTR pTo   Address of File Name(s) String(s) Double Null Term
fFlags                    LONG                 !FILEOP_FLAGS fFlags
fAnyOperationsAborted     BOOL                 !BOOL fAnyOperationsAborted
hNameMappings             UNSIGNED             !LPVOID hNameMappings
lpszProgressTitle         UNSIGNED             !PCSTR lpszProgressTitle - Address of *CSTRING Optional for  FOF_SIMPLEPROGRESS
    END ! } SHFILEOPSTRUCTA, *LPSHFILEOPSTRUCTA;

I would declare the pFrom and pTo PCZZSTR as a Clarion STRING. Then terminate the file name with
'<0,0>' .


! Shell File Operations

FO_MOVE                    EQUATE(0001h)  !FO_MOVE 0x0001
FO_COPY                    EQUATE(0002h)  !FO_COPY 0x0002
FO_DELETE                  EQUATE(0003h)  !FO_DELETE 0x0003
FO_RENAME                  EQUATE(0004h)  !FO_RENAME 0x0004

! SHFILEOPSTRUCT.fFlags and IFileOperation::SetOperationFlags() flag values

FOF_MULTIDESTFILES         EQUATE(0001h)  !FOF_MULTIDESTFILES 0x0001
FOF_CONFIRMMOUSE           EQUATE(0002h)  !FOF_CONFIRMMOUSE 0x0002
FOF_SILENT                 EQUATE(0004h)  !FOF_SILENT 0x0004 // don't display progress UI (confirm prompts may be displayed still)
FOF_RENAMEONCOLLISION      EQUATE(0008h)  !FOF_RENAMEONCOLLISION 0x0008 // automatically rename the source files to avoid the collisions
FOF_NOCONFIRMATION         EQUATE(0010h)  !FOF_NOCONFIRMATION 0x0010 // don't display confirmation UI, assume "yes" for cases that can be bypassed, "no" for those that can not
FOF_WANTMAPPINGHANDLE      EQUATE(0020h)  !FOF_WANTMAPPINGHANDLE 0x0020 // Fill in SHFILEOPSTRUCT.hNameMappings
! Must be freed using SHFreeNameMappings
FOF_ALLOWUNDO              EQUATE(0040h)  !FOF_ALLOWUNDO 0x0040 // enable undo including Recycle behavior for IFileOperation::Delete()
FOF_FILESONLY              EQUATE(0080h)  !FOF_FILESONLY 0x0080 // only operate on the files (non folders), both files and folders are assumed without this
FOF_SIMPLEPROGRESS         EQUATE(0100h)  !FOF_SIMPLEPROGRESS 0x0100 // means don't show names of files
FOF_NOCONFIRMMKDIR         EQUATE(0200h)  !FOF_NOCONFIRMMKDIR 0x0200 // don't dispplay confirmatino UI before making any needed directories, assume "Yes" in these cases
FOF_NOERRORUI              EQUATE(0400h)  !FOF_NOERRORUI 0x0400 // don't put up error UI, other UI may be displayed, progress, confirmations
FOF_NOCOPYSECURITYATTRIBS  EQUATE(0800h)  !FOF_NOCOPYSECURITYATTRIBS 0x0800 // dont copy file security attributes (ACLs)
FOF_NORECURSION            EQUATE(1000h)  !FOF_NORECURSION 0x1000 // don't recurse into directories for operations that would recurse
FOF_NO_CONNECTED_ELEMENTS  EQUATE(2000h)  !FOF_NO_CONNECTED_ELEMENTS 0x2000 // don't operate on connected elements ("xxx_files" folders that go with .htm files)
FOF_WANTNUKEWARNING        EQUATE(4000h)  !FOF_WANTNUKEWARNING 0x4000 // during delete operation, warn if object is being permanently destroyed instead of recycling (partially overrides FOF_NOCONFIRMATION)
! #if (NTDDI_VERSION >= NTDDI_WINXP)
FOF_NORECURSEREPARSE       EQUATE(8000h)  !FOF_NORECURSEREPARSE 0x8000 // deprecated; the operations engine always does the right thing on FolderLink objects (symlinks, reparse points, folder shortcuts)
! #endif // (NTDDI_VERSION >= NTDDI_WINXP)
! #define FOF_NO_UI        (FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR) // don't display any UI at all