Browse for folder API - Preselecting a UNC path
Posted on 2001-07-18
I have a routine that displays the browse for folder using API calls and a callback to preselect the desired folder. Problem is, it doesn't work for UNC paths only paths that start with drive letters.
This is a serious problem in this case because there is a lot of selections to be made and they are all UNC paths. The paths are remembered but if the user goes to change one I don't want them to have to start from the root directory again. I want the path they last selected to be active when the dialog opens.
The code is rather long and complex but works find. The only thing I can think of is there may be a special call for UNC paths when initializing the path?
Here is the call back code. Very simple....
Public Function BrowseCallbackProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal lParam As Long, ByVal lpData As Long) As Long
Select Case uMsg
' On initialization, set the dialog's
' pre-selected folder using the pidl
' set as the bi.lParam, and passed back
' to the callback as lpData param.
SendMessage hWnd, BFFM_SETSELECTIONA, True, ByVal lpData