Copy, Move, Delete, Rename -- Explorer Like


Type SHFILEOPSTRUCT
hWnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAborted As Long
hNameMaps As Long
sProgress As String
End Type

Const INVALID_HANDLE_VALUE = -1
Const MAX_PATH = 260

Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type

Type WIN32_FIND_DATA
dwFileAttributes As Long ' Dateiattribute
ftCreationTime As FILETIME ' Erstellungsdatum
ftLastAccessTime As FILETIME ' Letzter Zugriff
ftLastWriteTime As FILETIME ' Letzte Speicherung
nFileSizeHigh As Long ' Gr??e (Hi)
nFileSizeLow As Long ' Gr??e (Lo)
dwReserved0 As Long ' bedeutungslos
dwReserved1 As Long ' bedeutungslos
cFileName As String * MAX_PATH ' Dateiname
cAlternate As String * 14 ' 8.3-Dateiname
End Type

Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (Byval
lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (Byval
hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Declare Function FindClose Lib "kernel32" (Byval hFindFile As Long) As Long
Declare Function SHFileOperation Lib "shell32.dll" (lpFileOp As SHFILEOPSTRUCT)
As Long
Declare Function SHEmptyRecycleBin Lib "shell32" Alias "SHEmptyRecycleBinA"
(Byval hwnd As Long, Byval pszRootPath As String, Byval dwFlags As Long) As Long

' Konstanten f?r lpFileOp.wFunc - erw?nschte Aktion
Const FO_MOVE = &H1 ' Move
Const FO_COPY = &H2 ' Copy
Const FO_DELETE = &H3 ' Delete (Recycle Bin)
Const FO_RENAME = &H4 ' Rename

' Konstanten f?r lpFileOp.fFlags - diverse Optionen
Const FOF_MULTIDESTFILES = &H1 ' pTo gibt f?r jedes Element in pFrom einen
Zielpfad an
Const FOF_SILENT = &H4 ' Keine Dialoge anzeigen
Const FOF_RENAMEONCOLLISION = &H8 ' Bei Namenskollisionen automatisch
umbenennen
Const FOF_NOCONFIRMATION = &H10 ' Keine Best?tigungen durch den Benutzer -
alle Fragen werden mit "Ja" beantwortet
Const FOF_ALLOWUNDO = &H40 ' Falls m?glich werden Undo-Informationen
gesichert
Const FOF_FILESONLY = &H80 ' Bei Angabe von WildCards (*.*) sollen nur
Dateien - nicht Verzeichnisse - ber?cksichtigt werden
Const FOF_SIMPLEPROGRESS = &H100 ' Einfacher Fortschrittsbalken - keine
Dateinamen anzeigen
Const FOF_NOCONFIRMMKDIR = &H200 ' Erzeugung von Verzeichnissen nicht
best?tigen lassen
Const FOF_NOERRORUI = &H400

Class DiskFile

Declare Private Function ExistFileDirDrive(FilePathName As String) As Integer
Declare Private Function DoIt(SHFO) As Long
Declare Private Function IsSingleFile(FileName As String) As Variant
Declare Private Function IsDriveAvailable(drivNam$) As Variant

Public Function CopyFile(SourceFile As String, DestFile As String, AFlag
As Integer) As Long

Dim SHFO As SHFILEOPSTRUCT
SHFO.wFunc = FO_COPY
SHFO.pFrom = SourceFile & vbNullChar
SHFO.pTo = DestFile & vbNullChar
SHFO.fFlags = AFlag
If IsSingleFile (SourceFile) Then
CopyFile = SHFileOperation(SHFO)
Else
If ExistFileDirDrive(SourceFile) Then
CopyFile = SHFileOperation(SHFO)
Else
CopyFile = -1
End If
End If
End Function

Public Function MoveFile(SourceFile As String, DestFile As String, AFlag
As Integer) As Long

Dim SHFO As SHFILEOPSTRUCT
SHFO.wFunc = FO_MOVE
SHFO.pFrom = SourceFile & vbNullChar
SHFO.pTo = DestFile & vbNullChar
SHFO.fFlags = AFlag<WHATLE
This was first published in November 2000

Dig deeper on Lotus Notes Domino User Settings

1 comment

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close