I have some questions regarding SHBrowseForFolder()
. I am using it with BIF_USENEWUI
, BIF_RETURNONLYFSDIRS
and BIF_VALIDATE
. I am mainly having problems with the edit box. I'd like it to function a bit differently.
Let us assume, I am at a valid directory
"C:\path"
. If I type in a non-existing folder (Let us call it"Folder1"
) into the textbox and then press OK, then the path I receive is"C:\path"
. Is there a way to have it so that when I press OK, it creates"Folder1"
in"C:\path"
and gives me the path"C:\path\Folder1"
? (Without having to use the Make New Folder button)Currently, I can click on
"Make New Folder"
, which creates a new folder that I can rename. In the text edit, it appears as New Folder (its default name). After I rename the folder, it still appears as New Folder in the text edit, unless I click on another folder and then click back on the newly named folder. Is there a way for the text edit to be updated as soon as I rename the folder?
1 install an application-defined callback function and specify the BIF_VALIDATE flag, then handle BFFM_VALIDATEFAILED and try to create the folder there.
2 you can subclass the dialog and the text edit in BFFM_INITIALIZED and look for TVN_BEGINLABELEDIT and TVN_ENDLABELEDIT from the tree control, then change the text in the edit control based on the change to tree node text when the user finishes editing. The dialog id for controls on the browse folder dialog is not documented, so there is a compatibility risk you need to consider. I won't be surprised if your code breaks after a Windows update/upgrade, but as a user, this is not a feature I would miss anyway.