What is the lpstr filter for folders?

356 Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On