戻る


何かもう泥沼。
Private Type BrowseInfo
   hwndOwner As Long
   pIDLRoot As Long
   pszDisplayName As Long
   lpszTitle As Long
   ulFlags As Long
   lpfnCallback As Long
   lParam As Long
   iImage As Long
End Type
Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, _
                                                            ByVal lpBuffer As String) As Long
Private Declare Function lstrcat Lib "kernel32" Alias "lstrcatA" (ByVal lpString1 As String, _
                                                        ByVal lpString2 As String) As Long
使い方としては、
    Dim MyRtn As Long
    Dim MyStrDir As String
    Dim MyInf As BrowseInfo
    
    On Error GoTo MyErrTrap
    
    MyInf.lpszTitle = lstrcat("どうでもいいけど何か選べ", "")
    MyInf.ulFlags = 1
    MyRtn = SHBrowseForFolder(MyInf)
    If MyRtn = 0 Then
        MyStrDir = ""
    Else
        MyStrDir = String(256, Chr(0))
        Call SHGetPathFromIDList(MyRtn, MyStrDir)
        MyStrDir = Left(MyStrDir, InStr(MyStrDir, Chr(0)) - 1)
    End If
ぐらいでいいんじゃないかな、と。

定数は、知りません。
何かあるのかもしれないけど、これ以上かかわりたくないです。