Results 1 to 2 of 2

Thread: Folder Window

  1. #1
    TheSarlacc
    Guest

    Folder Window

    take a look at the screenshot and tell me how what code and/or controls i would use to get this window. thanks
    Attached Images Attached Images  

  2. #2
    Matthew Gates
    Guest
    VB Code:
    1. Private Declare Sub CoTaskMemFree Lib "ole32.dll" _
    2. (ByVal hMem As Long)
    3.  
    4. Private Declare Function lStrCat Lib "kernel32" Alias "lstrcatA" _
    5. (ByVal lpString1 As String, ByVal lpString2 As String) As Long
    6.  
    7. Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As _
    8. BROWSEINFO) As Long
    9.  
    10. Private Declare Function SHGetPathFromIDList Lib "shell32" _
    11. (ByVal pidList As Long, ByVal lpBuffer As String) As Long
    12.  
    13. Private Type BROWSEINFO
    14.     hwndOwner As Long
    15.     pIDLRoot As Long
    16.     pszDisplayName As Long
    17.     lpszTitle As Long
    18.     ulFlags As Long
    19.     lpfnCallback As Long
    20.     lParam As Long
    21.     iImage As Long
    22. End Type
    23.  
    24. Private Const BIF_RETURNONLYFSDIRS = 1
    25.  
    26. Public Function BrowseForFolder(ByVal lHwnd As Long, ByVal sPrompt As String) As String
    27.     Dim tBI As BROWSEINFO
    28.     Dim lList As Long
    29.     Dim lResult As Long
    30.     Dim sPath As String
    31.     Dim sString As String
    32.    
    33.     sString = Space(260)
    34.     With tBI
    35.         .hwndOwner = lHwnd
    36.         .lpszTitle = lStrCat(sPrompt, Chr(0))
    37.         .pszDisplayName = StrPtr(sString)
    38.         .ulFlags = BIF_RETURNONLYFSDIRS
    39.     End With
    40.     lList = SHBrowseForFolder(tBI)
    41.     sString = StrConv(sString, vbUnicode)
    42.     If lList Then
    43.         sPath = Space(260)
    44.         lResult = SHGetPathFromIDList(lList, sPath)
    45.         Call CoTaskMemFree(lList)
    46.         sPath = Left$(sPath, InStr(sPath, Chr(0)) - 1)
    47.     End If
    48.     BrowseForFolder = sPath
    49. End Function
    50.  
    51.  
    52.  
    53. Private Sub Command1_Click()
    54.     Msgbox BrowseForFolder(hWnd, "Select Directory..")
    55. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width