Is it possible, to ask to the explorer with PB, to copy/cut a full directory or one or several files like if it's him he do the job (when i use the mouse for exampler)

Have a good day
Code: Select all
EnableExplicit
; paths
Global Dim SrcFiles$(1), Dim OutFiles$(1)
SrcFiles$(0) = "C:\1.txt"
OutFiles$(0) = "D:\1.txt"
; fill structure
; see similar constants for other ops: like #FO_MOVE, #FOF_SILENT
Define A.SHFILEOPSTRUCT
With A
\hwnd = 0
\wFunc = #FO_COPY ; what to do
\pFrom = @SrcFiles$(0) ; list of source paths
\pTo = @OutFiles$(0) ; list of destination paths
\fFlags = #FOF_ALLOWUNDO ; how to do
EndWith
; finally copy file1 to file2 using explorer shell
SHFileOperation_(A)
Code: Select all
Procedure.l FileOp(FromLoc.s, ToLoc.s, Flag)
;Flag can be the following: #FO_COPY, #FO_DELETE, #FO_MOVE, #FO_RENAME
Switches.SHFILEOPSTRUCT ;Windows API Structure
;The filename needs to be double null-terminated.
temp1$=Space(#MAX_PATH+SizeOf(character))
RtlZeroMemory_(@temp1$, #MAX_PATH+SizeOf(character))
PokeS(@temp1$, FromLoc)
temp2$=Space(#MAX_PATH+SizeOf(character))
RtlZeroMemory_(@temp2$, #MAX_PATH+SizeOf(character))
PokeS(@temp2$, ToLoc)
Switches\wFunc = Flag
Switches\pFrom = @temp1$
Switches\pTo = @temp2$
Switches\fFlags = #FOF_NOCONFIRMATION | #FOF_NOCONFIRMMKDIR
Result.l = SHFileOperation_(@Switches)
; If cancel was pressed then result will NOT be zero (0)
ProcedureReturn Result
EndProcedure
Code: Select all
Result = CopyDirectory(SourceDirectory$, DestinationDirectory$, "", #PB_FileSystem_Recursive|#PB_FileSystem_Force)
Code: Select all
Result = DeleteDirectory(Directory$, "", #PB_FileSystem_Recursive|#PB_FileSystem_Force)