Grüss Sie,
Folgendes Problem:
Um einen Ordner zu kopieren verwendete ich einen API Call (siehe
unten). Das Problem ist nur wie bekomme ich die Sicherheitsabfrage ob
ich die Dateien wirklich überschreiben will weg?
Danke im voraus
Michael Schieferer
Public Const FO\_MOVE As Long = &H1
Public Const FO\_COPY As Long = &H2
Public Const FO\_DELETE As Long = &H3
Public Const FO\_RENAME As Long = &H4
Public Const FOF\_MULTIDESTFILES As Long = &H1
Public Const FOF\_CONFIRMMOUSE As Long = &H2
Public Const FOF\_SILENT As Long = &H4
Public Const FOF\_RENAMEONCOLLISION As Long = &H8
Public Const FOF\_NOCONFIRMATION As Long = &H10
Public Const FOF\_WANTMAPPINGHANDLE As Long = &H20
Public Const FOF\_CREATEPROGRESSDLG As Long = &H0
Public Const FOF\_ALLOWUNDO As Long = &H40
Public Const FOF\_FILESONLY As Long = &H80
Public Const FOF\_SIMPLEPROGRESS As Long = &H100
Public Const FOF\_NOCONFIRMMKDIR As Long = &H200
Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Long
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String
End Type
Declare Function SHFileOperation Lib "Shell32.dll" \_
Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As
Long
CODE IN FORM
Private Sub Command1\_Click()
Dim result As Long
Dim fileop As SHFILEOPSTRUCT
With fileop
.hwnd = Me.hwnd
.wFunc = FO\_COPY
.pFrom = "C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\VB.HLP"
& \_
vbNullChar & \_
"C:\PROGRAM FILES\MICROSOFT VISUAL BASIC\VB.CNT" & \_
vbNullChar & vbNullChar
'or to copy all files use this line
'.pFrom = "C:\*.\*" & vbNullChar & vbNullChar
'The directory or filename(s) to copy into terminated in
2
'nulls.
.pTo = "C:\testfolder\" & vbNullChar & vbNullChar
.fFlags = FOF\_SIMPLEPROGRESS Or FOF\_FILESONLY
End With
result = SHFileOperation(fileop)
If result 0 Then 'Operation failed
MsgBox result, , "Copy Operation Failed"
Else
If fileop.fAnyOperationsAborted 0 Then
MsgBox fileop.fAnyOperationsAborted, , "Operation
Aborted"
End If
End If
End Sub
Private Sub Form\_Load()
Command1.Caption = "Copy Test"
End Sub