Hi Herfried,
Thanks for the examples however I couldn't get my implementation to work.
Have you any experience with this function? Perhaps you can tell what I'm
doing wrong.
Here's my code:
---------------------------
Module Shell_File_Operation
Private Structure FileOperationStructure
Dim hWnd As IntPtr
Dim Operation As FileOperation
Dim strSource As String
Dim strDestination As String
Dim Flags As ShellFlags
Dim Aborted As Boolean
Dim FileNameMappings As Integer
Dim strProgress As String
End Structure
Private Enum FileOperation As Integer
Move = &H1
Copy = &H2
Delete = &H3
Rename = &H4
End Enum
Private Enum ShellFlags As Short
MultipleDestinations = &H1
NoConfirmation = &H10
ConfirmOperation = &H2
SilentOperation = &H4
RenameOnCollision = &H8
UseFileNameMappings = &H20
End Enum
Private Declare Function SHFileOperation Lib "shell32" Alias
"SHFileOperationA" (ByVal FileOp As FileOperationStructure) As Integer
Public Sub ShellFileMove(ByVal strSource, ByVal strDestination)
Dim stcMove As FileOperationStructure
'stcMove.hWnd = objMain.Handle
'stcMove.Aborted = False
stcMove.strSource = strSource
'stcMove.strDestination = FilePath(strDestination) & "\"
stcMove.strDestination = strDestination
stcMove.Operation = FileOperation.Move
'stcMove.strProgress = "Test Progress String..."
stcMove.Flags = ShellFlags.NoConfirmation
SHFileOperation(stcMove)
End Sub
End Module