I am writting a program which requires the user to select a directory. Does a control exist which displays a dialog that allows the user to select a destination directory?
try GetOpenFileName and GetSaveFileName. They display a system box save/saveas/open file/directory... Study how to work with structure OPENFILENAME. John Fill
I have looked at the above but I see no way of displaying a dialog which only allows the user to select an output directory. For an example of what I require goto Tools->Options->Directories and then try changing the directory. A dialog should be displayed which only shows directories. Do I have to create this dialog manually? If so how would I create a listbox showing all the current directories?
I created this dialog manually using a CTreeView control. Many of the more common Visual C++ books have an example of this (Programming Windows with MFC 2nd Edition - Jeff Prosise). Alternately there is a fairly good example at
Hi, I had the same problem, it seemed to me that the easiest way was using SHBrowseForFolder() API function. Here I made a more simple function that wraps the API and gives you what you want:
And here is an example of how to call it:
BrowseForFolder(_T("Choose the output folder:",
GetSafeHwnd(), szOutputDir); (you get the full path into the third parameter, note that it must be already allocated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.