I am trying to open a dialog box where the user selects a certain folder on pure C , no .Net framework or C#, and am struggling to find how the lpstr would filter everything but directories. I am currently using the OPENFILENAME function. I tried filtering to .dir, but it does not work. Anyone know the actual extension or any solutons?
CodePudding user response:
The OPENFILENAME
struct is used with the old GetOpenFileName()
Common Dialog Box, which can't be used to select a folder. It is simply not designed for that purpose.
You need to use SHBrowseForFolder()
instead, or in Vista you can (and should) use the newer IFileOpenDialog
Common Item Dialog with the FOS_PICKFOLDERS
option enabled.
CodePudding user response:
Ended up using SHBrowseForFolder() https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shbrowseforfoldera