Path Picker with Network Capabilities

Sample Image

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.

  1. Copy the source files DlgGetPath.cpp and DlgGetPath.h to your Project directory and add them to your project.
  2. Change #include “PathPicker.h”

    to the name of your project as necessary.

  3. From within your project open the PathPicker.rc file and drag the Bitmap and Dialog into your project.
  4. 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 )
    		//Do some cool stuff with it here
    		//SetDlgItemText( IDC_EDIT_SEARCH_IN, dlgPath.GetPath() );

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.

  1. Link your project with PathPicker.lib and insert the following code where you want the dialog to appear.
  2. Place the PathPicker.DLL in the same directory as your app or the System directory.
    #include "PathPickerDll.h"
        //Once the parent window is created
        TCHAR szPath[200];
        ShowDialog( (long)m_hWnd, "Blar.", "Blar blar...", szPath, 199 );
        MessageBox( szPath );


  • This code was developed using VC++ 6.0, SP 2.0.
  • Notes on limitations are in Source file DlgGetPath.cpp.


Download DLL files and Method2 sample – 12 Kb

Download source – 20 KB


More by Author

Must Read