home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Files, total API manipulation with visual dialogs < prev    next >
Encoding:
Text File  |  1997-07-14  |  1.9 KB  |  56 lines

  1. 'Description: Gives access to File Explorer capabilities and shows
  2. '             progress dialog and / or error dialogs
  3.  
  4. 'Place the following code in a Module
  5.  
  6. 'Public Const FO_MOVE As Long = &H1
  7. 'Public Const FO_COPY As Long = &H2
  8. 'Public Const FO_DELETE As Long = &H3
  9. 'Public Const FO_RENAME As Long = &H4
  10. 'Public Const FOF_MULTIDESTFILES As Long = &H1
  11. 'Public Const FOF_CONFIRMMOUSE As Long = &H2
  12. 'Public Const FOF_SILENT As Long = &H4
  13. 'Public Const FOF_RENAMEONCOLLISION As Long = &H8
  14. 'Public Const FOF_NOCONFIRMATION As Long = &H10
  15. 'Public Const FOF_WANTMAPPINGHANDLE As Long = &H20
  16. 'Public Const FOF_CREATEPROGRESSDLG As Long =&H0
  17. 'Public Const FOF_ALLOWUNDO As Long = &H40
  18. 'Public Const FOF_FILESONLY As Long = &H80
  19. 'Public Const FOF_SIMPLEPROGRESS As Long = &H100
  20. 'Public Const FOF_NOCONFIRMMKDIR As Long = &H200
  21.  
  22. 'Type SHFILEOPSTRUCT
  23. '     hwnd As Long
  24. '     wFunc As Long
  25. '     pFrom As String
  26. '     pTo As String
  27. '     fFlags As Long
  28. '     fAnyOperationsAborted As Long
  29. '     hNameMappings As Long
  30. '     lpszProgressTitle As String
  31. 'End Type
  32.  
  33. 'Declare Function SHFileOperation Lib "Shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
  34.  
  35.  
  36.  
  37. 'Place the following code under a command button or in a menu, etc...
  38.  
  39. Dim result As Long, fileop As SHFILEOPSTRUCT
  40. With fileop
  41.         .hwnd = Me.hwnd
  42.         .wFunc = FO_COPY
  43.         .pFrom = "C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\VB.HLP" & vbNullChar & "C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\README.HLP" & vbNullChar & vbNullChar
  44. '       .pFrom = "C:\*.*" & vbNullChar & vbNullChar
  45.         .pTo = "C:\testfolder" & vbNullChar & vbNullChar
  46.         .fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY
  47. End With
  48. result = SHFileOperation(fileop)
  49. If result <> 0 Then
  50.         ' Operation failed
  51.         MsgBox Err.LastDllError 
  52. Else
  53.         If fileop.fAnyOperationsAborted <> 0 Then
  54.                       MsgBox "Operation Failed"
  55.          End If
  56. End If