(continued)

Environment: VC6 SP2
This DLL displays a directory tree similar to the one found in "Find in Files" Browse button. See below.
I have noticed several applications requiring a user to select a path that often use CFileDialog which does not fit the task very well. A better option is to use a Tree control but I have not found any that allow access to the network other than via mapped drives. Both methods lack the style that "Find in Files" provides.
I have developed the Dialog as a DLL for easy implementation. The source is written to put the Dialog object into a single class so it can be hacked out and used in any willing developers code.
How to use it.
I have provided two ways of using this code. Using the DLL directly requires the least effort, but allows least customisation.
Method 1 - Adding to your own project.
- Copy the source files DlgGetPath.cpp and DlgGetPath.h to your Project directory and add them to your project.
- Change #include "PathPicker.h"
to the name of your project as necessary.
- From within your project open the PathPicker.rc file and drag the Bitmap and Dialog into your project.
- Add the following code where you want to activate the Picker dialog. ie in a button handler.
#include "DlgGetPath.h" //Definition to get path
...
void CBlarOnButtonBrowse()
{
CDlgGetPath dlgPath( this );
dlgPath.SetTitle( _T("Blar..") );
dlgPath.m_sTopNote = _T("Blar blar blar...");
if( dlgPath.DoModal() == IDOK )
{
}
}
Method 2 - Using the DLL.
This method uses the DLL. It is a regular DLL so can also be used with inferior languages such as VB and Delphi. The following example is a simple static implementation however dynamic loading when the dialog is called is also possible.
- Link your project with PathPicker.lib and insert the following code where you want the dialog to appear.
- Place the PathPicker.DLL in the same directory as your app or the System directory.
#include "PathPickerDll.h"
...
TCHAR szPath[200];
ShowDialog( (long)m_hWnd, "Blar.", "Blar blar...", szPath, 199 );
MessageBox( szPath );
Notes.
- This code was developed using VC++ 6.0, SP 2.0.
- Notes on limitations are in Source file DlgGetPath.cpp.
Downloads
Download DLL files and Method2 sample - 12 Kb
Download source - 20 KB
History