Prova cosi:
In un modulo:
In un command button del form:codice:Public Const FO_COPY As Long = &H2 Public Type SHFILEOPSTRUCT hwnd As Long wFunc As Long pFrom As String pTo As String fFlags As Long fAnyOperationsAborted As Long hNameMappings As Long lpszProgressTitle As String End Type Public Declare Function SHFileOperation Lib "Shell32.dll" _ Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
codice:Private Sub Command1_Click() Dim result As Long Dim fileop As SHFILEOPSTRUCT With fileop .hwnd = Me.hwnd .wFunc = FO_COPY .pFrom = "C:\Pippo\*.*" & vbNullChar & vbNullChar .pTo = "C:\Topolino\" & vbNullChar & vbNullChar .fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY End With result = SHFileOperation(fileop) If result <> 0 Then MsgBox Err.LastDllError Else If fileop.fAnyOperationsAborted <> 0 Then MsgBox "Operazione annullata dall'utente!" End If End If End Sub


Rispondi quotando