Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/05/2008, 01:57
Avellaneda
Colaborador
 
Fecha de Ingreso: enero-2008
Ubicación: Unas veces aquí, otras veces allí
Mensajes: 1.482
Antigüedad: 16 años, 3 meses
Puntos: 37
Respuesta: FileSystemObject comprobar si ha terminado una copia de carpeta

Hola,

en vez de utilizar FSO puedes hacerlo con la API SHFileOperation, que te muestra la típica ventana con una barra de progreso y el mensaje de "Quedan xx segundos.."

Código:
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private Const FO_COPY = &H2
Private Const FOF_ALLOWUNDO = &H40

Private Type SHFILEOPSTRUCT
    hWnd As Long
    wFunc As Long
    pFrom As String
    pTo As String
    fFlags As Integer
End Type

Private Sub Command1_Click()
' sobreescribe sin preguntar, si el directorio destino no existe, lo crea
CopiarConProgreso "C:\Carpeta Origen", "D:\Carpeta Destino"
End Sub

Public Sub CopiarConProgreso(sFuente As String, sDestino As String)
' copia todas las carpetas y subcarpetas del directorio origen
Dim SHOp As SHFILEOPSTRUCT
With SHOp
    .hWnd = 0
    .wFunc = FO_COPY
    .pFrom = sFuente & vbNullChar & vbNullChar
    .pTo = sDestino & vbNullChar & vbNullChar
    .fFlags = FOF_ALLOWUNDO
End With
SHFileOperation SHOp
End Sub