Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Folder browser - restricting root folder
I'm trying to restrict the root folder in the folder browser using windows api. I somehow need to obtain a folder's CSIDL or PIDL in order to restrict it (using the pidlroot setting). I'd be really grateful if somebody can suggest a solution.
Here is the function I have right now :
Public Function BrowseFolder() As String
Dim bi As BrowseInfo
Dim pidl As Long
Dim path As String
Dim Pos As Integer
BrowseFolder = ""
bi.lpszTitle = "Please select a Folder"
bi.ulFlags = &H1
pidl = SHBrowseForFolder(bi)
path = Space$(MAX_PATH)
If SHGetPathFromIDList(ByVal pidl, ByVal path) Then
Pos = InStr(path, Chr$(0))
BrowseFolder = Left(path, Pos - 1)
If (Right$(BrowseFolder, 1) <> "" And BrowseFolder <> "") Then
BrowseFolder = BrowseFolder & ""
Thanks a lot!
0 · ·