Link to home
Start Free TrialLog in
Avatar of Lescha
Lescha

asked on

Directories Search Dialog

Usually, setup/installation programs have an option of Browse Directory, for the directory in which to install the program. This option creates a Directory Search dialog, much like standard File Dialog but with directory tree only. Is there a standard dialog like that? If yes, where does it hide? If no, how can I _efficiently_ create one?
Avatar of naveenkohli
naveenkohli

You can do this by using CFileDialog in MFC.

CFileDialog dlg;
dlg.DoModal ();

For more ino check out the documentation for this dialog box class.
Avatar of Lescha

ASKER

I read and read and couldn't find how to force the CFileDialog to display only a directory tree, without the "files" window.

If there is a way to, please tell me.
You will have to look at the documentation for OPENFILENAME structure. HEre you can speify the filters for the file list control. Here is some notes from documentation.

nFilterIndex
-------------
Specifies the index of the currently selected filter in the File Types control. The buffer pointed to by lpstrFilter contains pairs of strings that define the filters. The first pair of strings has an index value of 1, the second pair 2, and so on. An index of zero indicates the custom filter specified by lpstrCustomFilter. You can specify an index on input to indicate the initial filter description and filter pattern for the dialog box. When the user selects a file, nFilterIndex returns the index of the currently displayed filter.
If nFilterIndex is zero and lpstrCustomFilter is NULL, the system uses the first filter in the lpstrFilter buffer. If all three members are zero or NULL, the system does not use any filters and does not show any files in the file list control of the dialog box.

Avatar of Lescha

ASKER

That's not what I meant!

Please re-read my question carefully: I meant the dialog which has an edit box, a tree control with directory and nothing more in it except for a few buttons.

It's no problem building one myself, but since every setup program has one, I thought maybe there is one somewhere.

If you are so sure about CFileDialog, could you please give a piece of code of how to use it for that end?
ASKER CERTIFIED SOLUTION
Avatar of proskig
proskig

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lescha

ASKER

Thanks!