VB怎么单击按钮在桌面增加一个新建文件夹

来源:百度知道 编辑:UC知道 时间:2024/05/24 17:45:33

'在c盘增加一个123的文件夹.
'其他地方增加 更改目录就行
Private Sub Command1_Click()
MkDir "C:\123"
End Sub

'在桌面上增加就是

Private Sub Command1_Click()
MkDir "C:\Documents and Settings\All Users\桌面\新建文件夹"
End Sub

VB单击按钮在桌面新建 "new deskdiretory"文件夹

Private Const NOERROR = 0
Private Const CSIDL_Users_DESKTOPDIRECTORY = &H10
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As Long

Private Function GetSpecialPath(CSIDL As Long) As String
Dim s As Long
Dim path As String
Dim pidl As Long

s = SHGetSpecialFolderLocation(0, CSIDL, pidl)
If s = NOERROR Then
path = S