And just where are those directories?

Dear Dr. GUI,

I’ve been trying to replicate functionality I’ve seen in Microsoft Word 7.0. In the File Locations tab under Tools/Options, there is a button that allows the user to set a folder to store certain types of files. The dialog that appears looks and smells like it could be a common dialog, but I have not been able to find access to it. The dialog allows folder selection, but not file selection—like a cousin of the Open File dialog. Does such a common dialog exist? If so, can I access it from Visual Basic 4.0?

Thank you,
Tom Bellucco

Dr. GUI replies:

I seem to be spending a lot of time this column finding things for folks. I’m beginning to feel like St. Anthony.

Anyway, back down to earth: In Visual Basic (at least in version 5.0—Dr. GUI has upgraded and he’s/she’s/it’s not going back), you can use a DirListBox control to access similar functionality. (You can always put it on another form if you like.) In the Windows API, there isn’t a common dialog as such, but there is an API, SHBrowseForFolder, which is very easy to use. See the Windows SDK documentation for details.

In Java, you’ll need to write a wrapper (preferably a COM object) for the Win32 API function or write the functionality yourself in Java. Or write an ActiveX control in Visual Basic that does the job, then use it in your Java application.