可是先删除的话,也会出现个确认对话匡。我就是不要这个对话匡让它成为默认的,谁能写几句代码给我参考参考啊!
那好我把源码发上来!! Private Sub Command1_Click() Dim result As Long, fileop As SHFILEOPSTRUCT With fileop .hwnd = Me.hwnd .wFunc = FO_COPY .pFrom = ".\nihao\*.*" & vbNullChar & vbNullChar '拷贝文件 .pTo = "." & vbNullChar & vbNullChar '默认目录 .fFlags = FOF_SIMPLEPROGRESS Or FOF_FILESONLY End With result = SHFileOperation(fileop) If result <> 0 Then MsgBox Err.LastDllError Else If fileop.fAnyoperationsaborted <> 0 Then MsgBox "operation Failed" End If End If End Sub 接下来是模块 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 hNameMapings As Long lpszprogresstitle As String End Type Declare Function SHFileOperation Lib "Shell32.dll" Alias "SHFileOperationA" (lpFileop As SHFILEOPSTRUCT) As Long