Click here to Skip to main content
16,021,417 members
Articles / Desktop Programming / MFC
Article

File and directory picker control

Rate me:
Please Sign up or sign in to vote.
2.54/5 (11 votes)
11 Mar 20031 min read 60.9K   1.8K   20   5
A file and directory picker control

Introduction

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


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

Image 1


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

Image 2


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

Image 3

Using the code

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.

History

  • First revision, February 28, 2003

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralWroked great for me! Pin
KingTermite18-Nov-04 16:24
KingTermite18-Nov-04 16:24 
GeneralWhats wrong with... Pin
Andreas Saurwein12-Mar-03 3:11
Andreas Saurwein12-Mar-03 3:11 
GeneralRe: Whats wrong with... Pin
gnk12-Mar-03 9:16
gnk12-Mar-03 9:16 
GeneralRe: Whats wrong with... Pin
Andreas Saurwein12-Mar-03 12:15
Andreas Saurwein12-Mar-03 12:15 
GeneralRe: Whats wrong with... Pin
gnk13-Mar-03 9:35
gnk13-Mar-03 9:35 
a) well, the shell's GUI is based on controls (comctrl32 for example), again, how many versions of shell do we have now and will have in a few years?
b) "old windows" are not supported by MS. They're still used by customers. Our valuable customers. Few days ago I saw Windows NT 3.1 server running and serving clients. Do you have any data of Win32 installed base distribution? I really would like to see that.
c) you guarantee that for all possible combinations of installed software? And next time, sure, I will ask you what's necessary and what can be neglected. Poke tongue | ;-P
d) unfortunately it does not. I want vacation, long-long, and few thing more. Can it?
e) oh, yeah - no more ideas Cry | :((

I almost agreed with the rest. Almost.
I'm sure (do not know why, just guessing) you did write your own code as a replacement for system functions/API/etc ;
We all rewriting same things day by day, look: vms/unix/linux/win/beos/macos//netscape/ie//iis/apache//... - you can add much more. That's a little bit different? Same roots.

regards,
gnk

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.