使用 MakeSureDirectoryPathExists 迅速建立多级目录

来源:互联网 发布:07年最火的网络歌曲 编辑:程序博客网 时间:2024/06/10 03:03

Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal strPath As String) As Long

Private Function MakeMultiDirectory(ByVal strNewDirectory As String) As Boolean
    On Error Resume Next
    Dim strPath As String
    strPath = strNewDirectory & IIf(Right(strNewDirectory, 1) = "/", "", "/")
    If MakeSureDirectoryPathExists(strPath) <> 0 Then
       MakeMultiDirectory = True
    End If
End Function

 

 

原创粉丝点击