to change the view style (details, small icons, tiles, etc) push “More options” button.to change a view layout push “Organize” then check “Layout” subitems.to arrange views side by side drag from view tab caption.to split a view choose Window/Split menu.to open new views choose File/New menu item, press Ctrl+N or push the “New” button.Multiple-View File Explorer.zip (2533 downloads) The demo project uses CFileExplorer to make a simple file manager with multiple views. In a complete implementation you may change this, NOTE: just for demo purpose, this browses using the desktop as root folder. M_fileExplorer.BrowseToFolder(pszDesktopFolder) ::SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, pszDesktopFolder) Void CFileExplorerView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) Finally, let’s override CView::OnUpdate and browse for a folder.Handle WM_ERASEBKGND to avoid flickering when the parent view is resized.īOOL CFileExplorerView::OnEraseBkgnd(CDC* pDC).M_fileExplorer.SetRect(CRect(0, 0, cx, cy))
resize the browser to fit this window's clent area Void CFileExplorerView::OnSize(UINT nType, int cx, int cy) Handle WM_SIZE and resize the browser to fit the parent client area.NOTE: a further implementation can change the default valuesĮ->ReportError() // show what's going wrong M_fileExplorer.Initialize(m_hWnd, CRect(0, 0, 0, 0)) parent window is this window, default view mode is FVM_DETAILS, set default browser options EBO_SHOWFRAMES | EBO_ALWAYSNAVIGATE Int CFileExplorerView::OnCreate(LPCREATESTRUCT lpCreateStruct) In the OnCreate handler function, perform browser intialization like creating IExplorerBrowser instance, set initial options, set the parent window and folder options. Add a CFileExplorer member to CFileExplorerView class.Now, let’s use CFileExplorer in our application view class. The implementation of CFileExplorer class can be found in the demo project attached to this article. UINT nViewMode = FVM_DETAILS, UINT nFlags = FWF_NONE) Void Initialize(HWND hWndParent, const CRect& rc, Void SetOptions(EXPLORER_BROWSER_OPTIONS dwOptions = EBO_SHOWFRAMES|EBO_ALWAYSNAVIGATE) Here is its definition: // FileExplorer.h We can directly use IExplorerBrowser interface in the view class but to make things easier, I wrote an MFC-extension class named CFileExplorer that takes care of instantiating, releasing and using IExplorerBrowser methods.
Of course, you can choose other options, but for our purpose the most important are multiple tabbed documents and split window. Change generated view class name to CFileExplorerView.Application type: Multiple documents & Tabbed documents.In MFC Application Wizard check theese options:.Create a new MFC Application project (Ctrl+Shift+N).If have Visual Studio 2008 SP1 or newer, creating such type of project is no sweat. We have it so let’s use it! Create the multiple tabbed views application
#MFC APPLICATION WIZARD MULTIPLE TOP LEVEL DOCUMENTS WINDOWS#
Booth methods require a lot of work to do and may be a real overkill. Even more advanced methods like using IShellView and IFolderView are not so easy.įortunately, for Windows Vista, Windows Server 2008 and newer Windows versions, we can use IExplorerBrowser interface to get a “full featured” File Explorer. Another ones can choose to use IShellFolder and browse the shell namespace for the same purpose. Ones can say that’s a piece of cake: just use raw-WinAPI to populate a tree with folders then a list with folder contents. There are also other replacements that can be found over the Internet, however, let’s see how can we make our own file manager, having multiple (tabbed) views. File Explorer (aka Windows Explorer) is a well known and commonly used file manager application, shipped since early Windows 95 operating system.