Results 1 to 5 of 5

Thread: [RESOLVED] Browse Folder

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] Browse Folder

    How to eliminate this \ if I select the hard drive?I have double \\ . How to eliminate this


    Code:
    Private Const BIF_RETURNONLYFSDIRS = &H1
    Private Const BIF_DONTGOBELOWDOMAIN = &H2
    Private Const BIF_STATUSTEXT = &H4
    Private Const BIF_RETURNFSANCESTORS = &H8
    Private Const BIF_EDITBOX = &H10
    Private Const BIF_VALIDATE = &H20
    Private Const BIF_BROWSEFORCOMPUTER = &H1000
    Private Const BIF_BROWSEFORPRINTER = &H2000
    Private Const BIF_BROWSEINCLUDEFILES = &H4000
    
    Private Const MAX_PATH = 260
    
    Private Type T_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 T_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
    
    Public Function BrowseFolder(ByVal HwndOwner As Long, ByRef Titre As String) As String
    
        Dim lpIDList As Long
        Dim sBuffer As String
        Dim BrowseInfo As T_BROWSEINFO
    
        BrowseFolder = ""
        With BrowseInfo
            .HwndOwner = HwndOwner
            .lpszTitle = lstrcat(Titre, "")
            .ulFlags = BIF_RETURNONLYFSDIRS
        End With
    
        lpIDList = SHBrowseForFolder(BrowseInfo)
    
        If (lpIDList) Then
            sBuffer = Space(MAX_PATH)
            SHGetPathFromIDList lpIDList, sBuffer
            sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
            BrowseFolder = sBuffer
        End If
    End Function
    Attached Images Attached Images  

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