VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Browse Folders Dialog

by Sam Huggill (7 Submissions)
Category: Windows System Services
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 2nd June 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Browse Folders Dialog

API Declarations



Public Type SHITEMID 'mkid
cb As Long
abID As Byte
End Type

Public Type ITEMIDLIST 'idl
mkid As SHITEMID
End Type

Public Type BROWSEINFO 'bi
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Public Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" _ (ByVal pidl As Long, ByVal pszPath As String) As Long

Public Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" _ (lpBrowseInfo As BROWSEINFO) As Long

Public Const BIF_RETURNONLYFSDIRS = &H1

Rate Browse Folders Dialog



Dim bi As BROWSEINFO 
Dim IDL As ITEMIDLIST 
Dim pidl As Long 
Dim r As Long 
Dim pos As Integer 
Dim spath As String 
bi.hOwner = Me.hWnd
bi.pidlRoot = 0&
bi.lpszTitle = "Select your Windows\System\ directory"
bi.ulFlags = BIF_RETURNONLYFSDIRS
pidl& = SHBrowseForFolder(bi)
spath$ = Space$(512)
r = SHGetPathFromIDList(ByVal pidl&, ByVal spath$) 
If r Then
pos = InStr(spath$, Chr$(0)) 
lblSelected = Left(spath$, pos - 1) 
Else: lblSelected = "" 
End If
End Sub

Download this snippet    Add to My Saved Code

Browse Folders Dialog Comments

No comments have been posted about Browse Folders Dialog. Why not be the first to post a comment about Browse Folders Dialog.

Post your comment

Subject:
Message:
0/1000 characters