Naughter Software Logo

ShellCtrls2 v1.06

One of the many GUI classes I have developed and published on my web site is CFileTreeCtrl. This is a implementation from first principles of a tree control similar to the left hand side of Windows Explorer. Because it was implemented with custom code, it has diverged from the tree control shown in Windows Explorer in recent versions of Windows. In addition, some features in CFileTreeCtrl such as network enumeration no longer work in recent versions of Windows. In addition It would be nice to have a list control implementation similar to the right hand side of Windows Explorer. As of Visual Studio 2008 Service Pack 1, two classes became available which implemented this functionality using MFC. They are called CMFCShellTreeCtrl and CMFCShellListCtrl. I've recently taken a look at these two classes, but I wanted to bring forward all the functionality of CFileTreeCtrl in an implementation which provides better integration with the shell. I also took inspiration and ideas from the following codeproject articles: https://www.codeproject.com/Articles/1073213/Extending-MFC-shell-controls-functionality and https://www.codeproject.com/Articles/2271/ShellFolderTree. The result of all this work is ShellCtrls2.

 

The classes provided are:

CPIDL which provides a RAII class wrapper for a LPITEMIDLIST aka PIDLs. PIDLs are identifiers which the Windows shell uses to identify all objects which make up the Shell namespace. This class is based on the PIDL class provided by Oz Solomon with WndTabs extension for Visual C++ 6.0 but reimplemented using modern C++ 11 idioms.
CShellItemInfo2 This class is what is stored in the item data for each item in the tree control or list control
CShellTreeCtrl2 This class is an improved version of the built-in MFC class CMFCShellTreeCtrl
CShellListCtrl2 This class is an improved version of the built-in MFC class CMFCShellListCtrl
CShellCtrl2DropTarget This class is used to support OLE Drag / Drop in CShellTreeCtrl2 and CShellListCtrl2
CShellCtrlScopedRedraw This class is used in CShellTreeCtrl2 and CShellListCtrl2 to provide a simple RAII wrapper for the SetRedraw(FALSE), SetRedraw(TRUE) & RedrawWindow() calling sequence.

 

The demo application included in the download exercises all the functionality of each of the classes. A screen capture of the sample app running is as follows: 

CTreeFileCtrl screen capture

 

The enclosed zip file contains source code for the classes along with a VC 2019 solution file to build a demo application to demonstrate all the classes.

 

Copyright

 

Updates

v1.06 (14 December 2024)

v1.05 (12 December 2024)

v1.04 (11 December 2024)

v1.03 (4 June 2023)

v1.02 (23 April 2022)

v1.01 (17 December 2021)

v1.0 (25 July 2020)