1

Topic: Directory choice

Hello.
Wanted to learn, whether there is in WinAPI a function which shows dialogue of a choice of the directory in the form of a tree. . if the directory contains subdirectories, click on a tag "+", it is torn. In most Windows such, truth , this component or all the same function WinAPI sometimes met.
If is, prompt please its format in VBA

2

Re: Directory choice

Damir_85;

Option Explicit
Const BIF_RETURNONLYFSDIRS = &H1&
Const BIF_EDITBOX = &H10&
Const BIF_NEWDIALOGSTYLE = &H40&
Const BIF_USENEWUI = BIF_EDITBOX Or BIF_NEWDIALOGSTYLE
Const BIF_NONEWFOLDERBUTTON = &H200&
Const BIF_SHAREABLE = &H8000&
Private Sub Command1_Click ()
Dim Folder As Object
With CreateObject ("Shell. Application")
Set Folder =.BrowseForFolder (hWnd, "Pick a folder", BIF_RETURNONLYFSDIRS _
Or BIF_SHAREABLE _
Or BIF_USENEWUI _
Or BIF_NEWDIALOGSTYLE _
Or BIF_NONEWFOLDERBUTTON)
End With
If Folder Is Nothing Then
MsgBox "cancel"
Else
Me. Caption = Folder. Self. Path
End If
End Sub

3

Re: Directory choice

ATM-TURBO 2;
Thanks big.
Tell, and whether there is a reference manual on WinAPI with the description to VBA?

4

Re: Directory choice

Damir_85;
  Win32 API and Visual Basic

5

Re: Directory choice

big-duke;
Thanks

6

Re: Directory choice

If API, function SHBrowseForFolder.
SHBrowseForFolderW - Unicode. SHBrowseForFolderA - ANSI.

#If VBA7 Then
Declare PtrSafe Function SHBrowseForFolderW Lib "shell32" (lpbi As BrowseInfoW) As LongPtr
#Else
Declare Function SHBrowseForFolderW Lib "shell32" (lpbi As BrowseInfoW) As Long
#End If