Hallo, hab hier einen Code mit 'Neuer Ordner' erstellen.
Der Code geht im nächsten Post weiter !!!
Aufruf:
Private Sub Command1_Click()
Dim Pfad As String
Pfad = BrowseForFolder("Wählen Sie einen Ordner", "C:\", Me.hwnd, False, , _
True, False)
MsgBox Pfad
End SubIn Modul:
Option Explicit
Private Const DIALOG_CURRENT_SELECTION_TEXT As String = "Auswahl: "
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type Size
cx As Long
cy As Long
End Type
Private Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" ( _
lpBrowseInfo As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" ( _
ByVal lPIDL As Long, _
ByVal pszPath As String) As Long
Private Declare Sub CoTaskMemFree Lib "ole32.dll" ( _
ByVal pv As Long)
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" ( _
pDest As Any, _
pSource As Any, _
ByVal dwLength As Long)
Private Declare Function ILCreateFromPath Lib "shell32" _
Alias "#157" ( _
ByVal sPath As String) As Long
Private Declare Function LocalAlloc Lib "kernel32" ( _
ByVal uFlags As Long, _
ByVal uBytes As Long) As Long
Private Declare Function LocalFree Lib "kernel32" ( _
ByVal hmem As Long) As Long
Private Declare Function lstrcpyA Lib "kernel32" ( _
lpString1 As Any, _
lpString2 As Any) As Long
Private Declare Function lstrlenA Lib "kernel32" ( _
lpString As Any) As Long
Private Declare Function FindWindowEx Lib "user32.dll" _
Alias "FindWindowExA" ( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function GetWindowDC Lib "user32.dll" ( _
ByVal hwnd As Long) As Long
Private Declare Function GetWindowRect Lib "user32.dll" ( _
ByVal hwnd As Long, _
ByRef lpRect As RECT) As Long
Private Declare Function GetTextExtentPoint Lib "gdi32.dll" _
Alias "GetTextExtentPointA" ( _
ByVal hDC As Long, _
ByVal lpszString As String, _
ByVal cbString As Long, _
ByRef lpSize As Size) As Long
Private Declare Function PathCompactPath Lib "shlwapi.dll" _
Alias "PathCompactPathA" ( _
ByVal hDC As Long, _
ByVal pszPath As String, _
ByVal dx As Long) As Long
Private Const MAX_PATH = 260
Private Const WM_USER = &H400
Private Const BFFM_INITIALIZED = 1
Private Const BFFM_SELCHANGED As Long = 2
Private Const BFFM_SETSTATUSTEXTA As Long = (WM_USER + 100)
Private Const BFFM_SETSTATUSTEXTW As Long = (WM_USER + 104)
Private Const BFFM_ENABLEOK As Long = (WM_USER + 101)
Private Const BFFM_SETSELECTIONA As Long = (WM_USER + 102)
Private Const BFFM_SETSELECTIONW As Long = (WM_USER + 103)
Private Const BIF_NEWDIALOGSTYLE As Long = &H40
Private Const BIF_RETURNONLYFSDIRS As Long = &H1
Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000
Private Const BIF_STATUSTEXT As Long = &H4
Private Const LMEM_FIXED = &H0
Private Const LMEM_ZEROINIT = &H40
Private Const LPTR = (LMEM_FIXED Or LMEM_ZEROINIT) |