
For developers who use MFC this is a control which
subclasses an edit control to allow you to easily specify a folder. When the edit control is correctly setup it will look
like:

The button beside the edit control sports a tooltip when the button
is over it and when the button is hit, the following dialog is displayed:

In addition the control integrates with the AutoCompletion functionality of
Windows, so that a drop down list appears underneath the edit control which
allows the user to quickly select a specific folder. The code is most useful when you want to specify a folder from
somewhere in the user interface such as specifying a directory where a bunch of output
files will be placed.
The enclosed zip file contains
source for the routine and also includes a VC 6 project file to build a small dialog based
app to demonstrate the routine.
Copyright
- You are allowed to include the source code in
any product (commercial, shareware, freeware or otherwise) when your product
is released in binary form.
- You are allowed to modify the source code in
any way you want except you cannot modify the copyright details at the top
of each module.
- If you want to distribute source code with
your application, then you are only allowed to distribute versions released
by the author. This is to maintain a single distribution point for the
source code.
Updates
v1.1 (26 November 1997)
- Used internally by ddxgetfolder is another
class which you may find helpful. It's name is CChooseDirDlg which implements a standalone
directory picker dialog which can be used independently of the DDX/DDV functions.
v1.2 (16 September 1998)
- Updated all the documentation to be HTML based as with my other
shareware / freeware.
- Unicode enabled all the code and provision of Unicode build
configurations.
- VC 5 workspace files provided now as standard
- Provision of a DDV function.
- General tidy up of the sample app including removing all the
AppWizard generated comments.
- All code now compiles cleanly at warning level 4.
- Replaced all TRACE0 calls with TRACE.
- Changed name of main function from DDX_GetFolder to
DDX_FolderControl.
- Module name has been changed from ddxgetfolder to ddxfolder.
- Sample app now allows read only state of widget to be toggled.
- Addition of a DDX_FolderValue function.
- Change the ID's of the strings in the resource table which the code
uses.
v1.21 (17 September 1998)
- Minor update to some code comments and the
online documentation.
v1.22 (30 September 1998)
- Fixed a compiler problem in the rc file. I
was accidentally shipping the wrong resource.h file.
7 February 1999
- Minor bug fix in choosedirdlg.cpp.
v1.23 (3rd April 1999)
- Fixed another resource compiler
problem.
- Updated the copyright messages.
- General code tidy up.
v1.24 (11 December 1999)
- Cosmetic item where now a 1 pixel space is included
between the edit control and the "..." button.
v1.25 (14 May 2000)
- The "..." button now supports being tabbed
into i.e. the WS_TABSTOP style
v1.26 (17 May 2000)
- The width of the underlying edit control is now shrunk
when the "..." button is created. This makes layout of the control
using the resource designer a lot simpler.
v1.27 (18 July 2000)
- Removed an unreferenced variable from the demo app
module "testgetfolderDlg.cpp"
- Width of the edit button is now determined from the
text which it displays.
v1.28 (24 May 2001)
- Fixed a problem with the Z-Order of the control being
set incorrectly.
- Updated copyright message.
v1.29 (9 January 2003)
- Updated copyright details.
- Changed a class name from "CModifyButton" to the better
named "CDDXFileModifyButton".
- Enabled state of control is now reflected to buddy
button edit control. Thanks to "matro" for pointing out this problem.
- Made the "CGetFolderControl::Edit" virtual for easier
customisation.
- Made all strings used by the classes easier to modify
by making them virtual methods of the class
- Made the "CGetFolderControl::AddEditButton" method
virtual for easier customisation.
v1.30 (19 July 2006)
- Updated copyright details.
- Updated documentation to use the same style as the web site.
- Addition of a CCHOOSEDIRDLG_EXT_CLASS preprocessor macro to allow the code
to be easily added to an extension dll.
- Addition of a CDDXFOLDER_EXT_CLASS preprocessor macro to allow the code
to be easily added to an extension dll.
- Optimized CDDXFolderModifyButton constructor code
- Removed support for the old style directory picker dialog which used a modified
version of the File Open dialog.
- Changed the names of the constants used for DDV_FolderControl
- Added support for a DDXGETFOLDER_FOLDERMUSTEXIST flag
- Removed the GetFolder and SetFolder methods as they are not really required
- Verified code clean compiles in VC2005
v1.31 (29 July 2006)
- Initial enabled state of the edit control is now reflected into the edit
button when AddEditButton is called.
v1.32 (11 August 2006)
- Reworked all the use of string resources. Now all the string resources
used by the control are all loaded in one single virtual function. In
addition if you do not want to use inheritance, all the strings can be
customized via Get/Set methods.
- Broke the DDV functionality into seperate discreet DDV functions
- The dialog control id of the edit button can now be specified via the
SubclassEdit and DDX_FilenameControl functions
v1.33 (19 August 2006)
- Control now takes advantage of the AutoCompletion functionality (IAutoComplete
et al) built into Windows to improve the UI experience. If enabled then a
drop down list will appear underneath the edit control which allows the
user to quickly select a specific
folder. The code uses the COM interfaces (IAutoComplete) to AutoCompletion
instead of the more simplified functionality provided by SHAutoComplete.
This allows the code to customize the auto completion UI so that only file
system folders are selectable.
v1.34 (25 August 2006)
- Minor update to the name of one of the string resources used by
DDXFolder
v1.35 (19 November 2007)
- Minor update to display HRESULT's correctly.
- Minor tidy up to remove old style AppWizard comments
v1.36 (21 November 2007)
- The code now uses the value 32 instead of the enum ACLO_FILESYSDIRS in
the call to IID_IACList2::SetOptions. This is because newer versions of the
Windows SDK make this value dependent on the setting of the _WIN32_IE
preprocessor macros. Thanks to Alexey Kuznetsov for reporting this issue.