When I try to instantiate a CFileDialog
object it shows both the folders and files. How do you create a CFileDialog
that browses for folders alone?
相关问题
- how to call a C++ dll from C# windows application
- efficiently calling unmanaged method taking unmana
- Why is my COM factory never released during the pr
- Create CFrameWnd gives first-chance exceptions--wh
- Underline is drawn outside of rectangle reported b
相关文章
- C++: Callback typedefs with __stdcall in MSVC
- Is it possible to check whether you are building f
- Which VC++ redistributable package to choose (x86
- MFC CListView响应HDN_ITEMCHANGING后改变列宽无法自动显示隐藏水平滚动条
- How can I handle the Return key in a CEdit control
- How can I create a guid in MFC
- How to convert Byte Array to hex string in visual
- Visual Studio unable to recognise my MFC library f
Seems to me the answer you are asking for is inside the code of
of the
file.
If you do not have access to the code, I will post the essential part of it:
As you see, Microsoft itself does not use the Cfiledialog class when wants to open a dialog for picking folders.
For using code like that, your application class MUST be derived from CWinAppEx, not CWinApp
Like someone mentioned, use CFolderPickerDialog which works great. I would like to give you example how to use it especially when using the multi select flag:
It is very simple, really.
Use
CFolderPickerDialog
which is derived from the classCFileDialog
!You can't do it with
CFileDialog
.Either you will use SHBrowseForFolder Function or a wrapper for it,
like CFolderDialog - Selecting Folders.
Starting from Vista it's recommended to use IFileDialog with the FOS_PICKFOLDERS option (see msdn):
starting from windows vista,you can use the Common Item Dialog .