Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
PRB: SHBrowseForFolder() Fails When Entering an Invalid Folder Name
Article ID: 224342 - View products that this article applies to.
This article was previously published under Q224342
When a folder name is typed into the optional edit control in the Browse Folders dialog box and OK is clicked, the SHBrowseForFolder() function returns NULL and the pszDisplayName buffer is not set.
The SHBrowseForFolder() function returns NULL if an invalid folder name is typed into the optional edit control.
To allow only a valid folder to be returned from the SHBrowseForFolder() function, use an application-defined callback function and the BIF_VALIDATE flag.
Steps to Reproduce BehaviorThe following Win32 application demonstrates how to use the BrowseCallbackProc() function to validate a folder name that is typed into the optional edit box in a Browse Folder dialog box.
To demonstrate the problem that occurs when an invalid folder name is entered, remove the comment characters from the #define SHOW_PROBLEM line: