Dim result As Long
Dim lenFileop As Long
Dim foBuf() As Byte
Dim fileop As SHFILEOPSTRUCT
lenFileop = LenB(fileop)
ReDim foBuf(1 To lenFileop)
With fileop
.hwnd = Me.hwnd
.wFunc = FO_COPY
.pFrom = "D:\Data1.cab" _
& vbNullChar _
& "D:\instmsiw.exe" _
& vbNullChar _
& vbNullChar
.pTo = "c:\cop\" & vbNullChar & vbNullChar
.fFlags = FOF_SIMPLEPROGRESS Or FOF_NOCONFIRMATION Or _
FOF_NOCONFIRMMKDIR
.lpszProgressTitle = "Se están copiando los archivos " & _
"Ok." & vbNullChar _
& vbNullChar
End With
Call CopyMemory(foBuf(1), fileop, lenFileop)
Call CopyMemory(foBuf(19), foBuf(21), 12)
result = SHFileOperation(foBuf(1))
If result <> 0 Then ' Falló la operación
MsgBox Err.LastDllError 'Muestra el error .devuelto por la API
Else
If fileop.fAnyOperationsAborted <> 0 Then
MsgBox "La Operacíón ha Fallado"
End If
End If