I have this call:
oShell.BrowseForFolder(Me.hwnd, "Select path:", 0, "C:\dir\")
This opens a standard file browser dialog with "C:\dir\" as root. My problem is that you can not browse above the root folder. (as specified in doc http://msdn.microsoft.com/en-us/library/bb774065(v=vs.85).aspx)
Any suggestions on oppening this dialog with a selected path and full browsing posibility?
Thanks
The way to do this involves calling the underlying API,
SHBrowseForFolder()
.Since you want the entire shell namespace to be available you need to pass
NULL
aspidlRoot
. In order to select your desired folder you will need to provide a callback inlpfn
. Make this callback respond toBFFM_INITIALIZED
by setting the selected folder. This selection is performed by sending theBFFM_SETSELECTION
message to the dialog's window handle (passed to the callback function).No code because I don't have VB6, but hopefully this outline of the method is enough to get you on your way.
Here a code ready for copy and paste in a C++ class:
Karl E Peterson's excellent website contains a sample which demonstrates the API call
SHBrowseForFolder
with a callback, as in David Heffernan's answer.The KeyStuff project
Look at
MFolderBrowse.bas
, routineBrowseForFolderByPIDL
which passes a callback functionBrowseCallbackProc
.Try the old CCRP project. It has a nicely done implementation of the Browse dialog. I used it in several of my projects and it has properties to address the issue you are having.