Option Explicit '方法一
Private Declare Function SHCreateDirectoryEx Lib \"shell32\" Alias \"SHCreateDirectoryExA\" (ByVal hwnd As Long, ByVal pszPath As String, ByVal psa As Any) As Long
Private Sub Command1_Click()
SHCreateDirectoryEx Me.hwnd, \"d:\est78009\\hello\\haha\ByVal 0&
End Sub '方法二
Private Declare Function MakeSureDirectoryPathExists Lib \"imagehlp.dll\" (ByVal lpPath As String) As Long
Private Function MakeDir(ByVal sDirectory As String) As Boolean
On Error GoTo ErrHandle Dim lngResult As Long
sDirectory = sDirectory & IIf(Right(sDirectory, 1) = \"\\\lngResult = MakeSureDirectoryPathExists(sDirectory) MakeDir = IIf(lngResult = 0, False, True) ErrHandle: If Err <> 0 Then MakeDir = False End If End Function
Private Sub Command2_Click() MakeDir \"d:\\abcd\\def\\ghi\\\" End Sub
因篇幅问题不能全部显示,请点此查看更多更全内容