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 · ·