My requirement is that the user should be able to select only folders and not the files. Is there a way to show files as disabled (grayed out) in the listbox so that the only option is to select folders ?
When the "This path does not exist, do you want to create it?" dialog appears, selecting 'NO' creates it anyway.
Adding 'else return NULL' seems to fix it
if(AfxMessageBox(cstrPath + _T("\n") + _T("\n") +_T("This path does not exist. Do you want to create it?"),
MB_YESNO | MB_ICONQUESTION) == IDYES)
else return NULL; // this line has been added
I have inherited this code from a colleague,so I apologise if this comment is inaccurate.
Is it possible to force the user to select an existing directory?
I've tried using both OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST, but neither changes the behaviour of the dialog box if a nonexistant path is entered in the text box - the 'Path does not exist, do you wish to create it' message is still displayed.
I want the user to be able to type the path as well as select it with the mouse, so I can't just set the edit box to Read Only.
I use this class and it's very cool , BUTTT -->
When trying to select a folder from the network :
for example : "\\websql\student\" ,
an Error Message Box ""Invalid Folder" is displayed.
I'v found your remark in the source :
//If the user has entered something like
//this is invalid but _access returns valid if this string is passed to
//it. So before giving it to _access validate it.