Pou₧itφ dialogovΘho okna Kopφrovat z Exploreru

Nßsledujφcφ p°φklad ilustruje zßlohu dokument∙ a VB program∙ do zßlo₧nφho adresß°e:

Dim lret As Long
Dim fileop As SHFILEOPSTRUCT

With fileop
   .hwnd = 0
   .wFunc = FO_COPY
   .pFrom = "C:\Program Files\DevStudio\VB\My Programs" & _
      vbNullChar & "C:\My Documents" & vbNullChar & vbNullChar
   .pTo = "c:\Backup of Documents" & vbNullChar & vbNullChar
   .lpszProgressTitle = "Prosφm Φekejte, probφhß zßloha ..."
   .fFlags = FOF_SIMPLEPROGRESS Or FOF_RENAMEONCOLLISION
End With

lret = SHFileOp(fileop)

If result <> 0 Then
'Operace spadla
   MsgBox Err.LastDllError
Else
   If fileop.fAnyOperationsAborted <> 0 Then
      MsgBox "Operace neprob∞hla v po°ßdku."
   End If
End If

Pro odeslßnφ tohoto adresß°e do koÜe, pokud je ji₧ p°φliÜ star²:

Dim lret As Long
Dim fileop As SHFILEOPSTRUCT

With fileop
   .hwnd = 0
   .wFunc = FO_DELETE
   .pFrom = "c:\Backup of Documents" & vbNullChar & vbNullChar
   .lpszProgressTitle = "Prosφm Φekejte, probφhß zßloha ..."
   .fFlags = FOF_SIMPLEPROGRESS Or FOF_ALLOWUNDO
End With

lret = SHFileOp(fileop)

If result <> 0 Then
   MsgBox Err.LastDllError
Else
   If fileop.fAnyOperationsAborted <> 0 Then
      MsgBox "Oprace neprob∞hla v po°ßdku."
   End If
End If

Zp∞t

Autor: The Bozena