File and Directory Picker Control

Tuesday Mar 4th 2003 by Lee Hamel
Share:

The FilePickCtrl class is very similar to what Explorer uses for views, but with some slight differences including the use of file masks, small and large icon sizes, directory-only display, and more. (The article and source code were updated.)

Environment: VC6

The classes that come with Visual Studio for picking files and directories work, but they aren't as clean and user friendly as they should be. My FilePickCtrl class is very similar to what Explorer uses for views, but with some slight differences. The following features are supported:

  • Display small or large icons for detected drives
  • Display small or large icons for files and directories
  • Add filemasks to limit display of files
  • Display only directories so the user can only choose a directory
  • Turn on/off the display of the current directory



Click here for a larger image.

Small icons for drives and files, with both files and directories being displayed



Click here for a larger image.

Large icons for drives and files, with both files and directories being displayed



Click here for a larger image.

Small icons for drives and files, with only directories being displayed

To add the control to your program, add FilePickCtrl.cpp and FilePickCtrl.h to your project. Drag FilePickCtrlDemo.rc into Resource Editor, expand the Dialog tree, highlight IDD_FILEPICKCTRL_DIALOG, hold down the Ctrl key, drag the dialog into your program's dialog tree, and close the window for FilePickCtrlDemo.rc. Your project should now have a copy of IDD_FILEPICKCTRL_DIALOG in its Resource Editor.

Downloads

Download source files - 28 Kb
Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved