SECIShellFolderImpl Class

template <class T, class TIShellView, class TIEnumIDList, class TPidlMgr>
class SECIShellFolderImpl: public IShellFolder

SECIShellFolderImpl

Defined in: SECIShellFolderImpl.h

Comments

This class is a wrapper of IShellFolder interface. This class is the central class in the our namespace extension framework. IShellFolder interface is the first interface Explorer will request from namespace extension. This class provides most common implementation for most of the methods in the IShellFolder. This class has to derived before it can be used. At the bare minimal, the derived class should provide the implementation of IUnknown and also provide reference counting. Using CComObjectRootEx and CoComClass from ATL is the general way to accomplish both of these. Generally, you may only need to override the GetPidlName virtual function and CompareIDS, GetUIObject and GetAttributesOf methods of IShellFolder interface. You will rarely need to touch CreateViewObject and EnumObjects methods. The BindToStorage method is not currently used by the shell.
This template class requires four template arguments, the first should be the derived class, the second one is the IShellView implementation class, the third is the IEnumIDList implementation class and the last one is the PIDL manager class that derived from SECPidlMgr template class.
Note that only one instance of our IShellFolder implementation class is created in the whole namespace extension, so we can place some global setting inside the IShellFolder implementation class and expose a extra interface to let other component to access and change settings. Here is a good example using this idea. As you know, that the view in the right pane of the Explorer is constantly created and destroyed. In order to store the sort settings of our list view, we cannot store the settings inside the IShellView implementation class. But we can store the settings in the IShellFoler implementation class, we then expose a custom interface from our IShellFolder implementation class. Since our view hold a pointer to our IShellView interface, you can query the custom interface to get and change the settings.
In the default implementation of the related interfaces, only SECIShellViewImpl class stored a pointer to IShellFolder interface, so if you need to access the value in IShellFolder implementation component from other interface implementation you need to store the IShellFolder interface in your derived class.

For a complete documentation of IShellFolder, please refer to windows SDK or MSDN from Microsoft.

Class Template Arguments

T

The dervied class

TIShellView

The IShellView implementation class

TIEnumIDList

The IEnumIDList implementation class

TPidlMgr

SECPidlMgr derived class

Class Members

LPITEMIDLIST  m_pPidl

PIDL of this folder

TPidlMgr*  m_pPidlMgr

A pointer to PIDL manager

CComPtr<IMalloc>  m_spMalloc

A smart pointer of IMalloc

SECIShellFolderImpl()

Constructor

virtual void  GetPidlName(LPCITEMIDLIST pidl, LPTSTR lpszOut, DWORD nSize)

Get string name of a give PIDL