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
as pidlRoot
. In order to select your desired folder you will need to provide a callback in lpfn
. Make this callback respond to BFFM_INITIALIZED
by setting the selected folder. This selection is performed by sending the BFFM_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.
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
, routine BrowseForFolderByPIDL
which passes a callback function BrowseCallbackProc
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With