' ============================================================== '
' QSHFileOperation component - version 1 January 2002 '
' Marcin Szafran '
' Implemented API SHFileOperation function. '
' Allows copy, rename, delete and move files and folders '
' with wildcard and recursivly... and much more! '
' ***** BE CAREFULL WITH DELETE AND RECURSE! ***** '
' Thanks for Jacques Philippe for his help '
' ============================================================== '
'= QSHFileOperation methods description ==================

'--- Copying ---
' .CopyEx: Copying with extended attributes
' .Copy: Simple copying
' Usage ObjName.CopyEx("ExistingFileName(s)","SourceFileName(s)",flags,handle)
' ObjName.Copy("ExistingFileName(s)","SourceFileName(s)")
' RQ keyword: - (none)

'--- Moving and Renaming ---
' .MoveEx: Moving with extended attributes
' .Move: Simple moving
' .RenameEx: Renaming with extended attributes
' .Rename: Simple renaming
' Usage ObjName.MoveEx("ExistingFileName(s)","SourceFileName(s)",flags,handle)
' ObjName.Move("ExistingFileName(s)","SourceFileName(s)")
' ObjName.RenameEx("ExistingFileName(s)","SourceFileName(s)",flags,handle)
' ObjName.Rename("ExistingFileName(s)","SourceFileName(s)")
' RQ keyword: RENAME (does not work with dirs)

'--- Deleting ---
' .DeleteEx: Deleting with deleting confirmation on/off and other extended attributes - enables delete to Recycle Bin
' .Delete: Simple deleting with deleting confirmation on/off - enables delete to Recycle Bin
' Usage ObjName.DeleteEx("FileName(s)",to_Bin_on/off,confirm_on/off,flags,handle)
' ObjName.Delete("FileName(s)",to_Bin_on/off,confirm_on/off)
' RQ keyword: KILL (does not work with dirs)

'= QSHFileOperation properties description ===============

' .DefaultFlagsEx: Setting default flags for methods with extended attributes (.MethodNameEx) - now = 0
' .DefaultFlags: Setting default flags for simple methods (.MethodName)

 

' I hope that parameters names are clear

Function CopyEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long
 

Function Copy (dSHfoFrom As String, dSHfoTo As String) As Long
 

Function MoveEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long
 

Function Move (dSHfoFrom As String, dSHfoTo As String) As Long
 

Function RenameEx (dSHfoFrom As String, dSHfoTo As String, _
SHfoFlags As Integer, SHfoHandle As Long) As Long
 

Function Rename (dSHfoFrom As String, dSHfoTo As String) As Long
 

Function DeleteEx (dSHfoFrom As String, SHfoToBin As Integer, SHConfirm As Integer, _
SHfoFlags As Integer, SHfoHandle As Long) As Long
 

Function Delete (dSHfoFrom As String, SHfoToBin As Integer, SHConfirm As Integer) As Long
 

'= CONSTANTS =============================================

'--- Operations ---

Const foMove = &H1 ' Move the files specified in pFrom to the location specified in pTo
Const foCopy = &H2 ' Copy the files specified in the pFrom member to the location specified in the pTo member
Const foDelete = &H3 ' Delete the files specified in pFrom
Const foRename = &H4 ' Rename the file specified in pFrom. You cannot use this flag to rename multiple files with a single function call. Use FO_MOVE instead

'--- Flags - should be set with OR operator if used more than one ---
'--- Constants names were changed to RapidQ kind --------------------

Const fofAllowUndo = &H40 ' Preserve Undo information, if possible. If pFrom does not contain fully qualified path and file names, this flag is ignored
Const fofConfirmMouse = &H2 ' Not currently used
Const fofFilesOnly = &H80 ' Perform the operation on files only if a wildcard file name (*.*) is specified
Const fofMultiDestFiles = &H1 ' The pTo member specifies multiple destination files (one for each source file) rather than one directory where all source files are to be depos
Const fofNoConnectedElements = &H2000 ' Do not move connected files as a group. Only move the specified files
Const fofNoConfirmation = &H10 ' Respond with "Yes to All" for any dialog box that is displayed
Const fofNoConfirmMkDir = &H200 ' Do not confirm the creation of a new directory if the operation requires one to be created
Const fofNoCopySecurityAttribs = &H800 ' Do not copy the security attributes of the file
Const fofNoErrorUI = &H400 ' Do not display a user interface if an error occurs
'Const fof_RecurseReparse = ' Recurse into reparse points. The default is to not recurse
'Const fof_NoRecurseReparse = ' Treat reparse points as objects, not containers. You must set _WIN32_WINNT to 5.01 or later to use this flag
Const fofNoRecursion = &H1000 ' Only operate in the local directory. Don't operate recursively into subdirectories
Const fofRenameOnCollision = &H8 ' Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists
Const fofSilent = &H4 ' Do not display a progress dialog box
Const fofSimpleProgress = &H100 ' Display a progress dialog box but do not show the file names
'Const fofWantMappingHandle = &H20 ' If FOF_RENAMEONCOLLISION is specified and any files were renamed, assign a name mapping object containing their old and new names to the hNameMappings member
Const fofWantNukeWarning = &H4000 ' Send a warning if a file is being destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION