Creating a File Explorer-Style MFC Application

Many Windows system applications use the user interface (UI) for File Explorer. When you start File Explorer, for example, you see an application with a vertical splitter bar dividing the client area. The left side of the client area provides navigation and browsing features, and the right side of the client area shows details pertinent to the selection in the left pane. When a user clicks an item in the left pane, the application repopulates the right pane. In an MDI application, you can use commands on the View menu to change the amount of detail shown in the right pane. (In an SDI or multiple top-level document application, you can change the detail using the toolbar buttons only.)

The contents of the panes depend on the application. In a file-system browser, the left pane shows a hierarchical view of directories or machines, or machine groups, while the right pane displays folders, individual files, or machines, and details about them. The contents don't necessarily have to be files. They could be e-mail messages, error reports, or other items in a database.

The wizard creates the following classes for you:

  • The CLeftView class defines the left pane of the client area. It's always derived from CTreeView.

  • The CProjNameView class defines the right pane of the client area. By default, it's derived from CListView but can be another type of view depending on the class you specify from the Base class list in the Generated Classes page of the wizard.

The generated application can have a single document interface (SDI), a multiple document interface (MDI), or a multiple top-level documents architecture. Each frame window the application creates is vertically split using CSplitterWnd. Coding this application type is similar to coding a normal MFC application that uses a splitter, except that this type of application has separate control views within each splitter pane.

If you use the default list view in the right pane, the wizard creates additional menu choices (in MDI applications only) and toolbar buttons to switch the view's style among large icons, small icons, list, and detail modes.

To begin creating a File Explorer-style MFC executable

  1. Follow the directions in Creating an MFC Application.

  2. In the MFC Application Wizard Application Type page, select the File Explorer project style. (It may show as Windows Explorer in your version of Visual Studio. In the past, the file manager was renamed Windows Explorer. Starting in Windows 10, it was renamed back to File Explorer. If your version of Visual Studio has Windows Explorer in the dropdown, this is the option you want for a File Explorer project).

  3. Set any other options you want on the other pages of the wizard.

  4. Click Finish to generate the skeleton application.

For more information, see:

See also

MFC Application Wizard
Creating a Web Browser-Style MFC Application
Creating a Forms-Based MFC Application