如题!

解决方案 »

  1.   

    '先引用Microsoft Scripting Runtime.Private Sub Command2_Click()
    Dim fsoTest As New FileSystemObject
    fsoTest.DeleteFolder ("f:\abc\ccc")
    End Sub
      

  2.   

    Private Sub Command1_Click()
        Dim f As New FileSystemObject
        f.DeleteFolder "c:\HiJxc", True
        
        Set f = Nothing
    End Sub
      

  3.   

    :|
    有抄袭的嫌疑没办法遇到有钱人 :Phttp://community.csdn.net/Expert/topic/3591/3591713.xml?temp=2.544802E-02
      

  4.   

    Private Const FO_DELETE = &H3   ' 删除Private Const FOF_ALLOWUNDO = &H40 ' 移入回收站
    Private Const FOF_CONFIRMMOUSE = &H2 ' 直接删除。不放入回收站
    Private Const FOF_NOCONFIRMATION = &H10 ' 没有提示Private Type SHFILEOPSTRUCT
        hwnd As Long
        wFunc As Long
        pFrom As String
        pTo As String
        fFlags As Integer
        fAborted As Boolean
        hNameMaps As Long
        sProgress As String
    End TypePrivate Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
    sub command1_click()
        Dim SHFileOp As SHFILEOPSTRUCT
        
        With SHFileOp
            .wFunc = FO_DELETE
            .pFrom = "要删除的文件夹或文件"
            .fFlags = &H2 Or &H10    ' 直接删除且不显示进度
        End With
        SHFileOperation SHFileOp
    end sub这个API还可以复制、移动等操作,很不错