Structuring a Namespace Extension
As is the case with shell extensions, a namespace extension is implemented as a COM in-process server DLL. For even the simplest of extensions, experience with COM, OLE, and the behavior of the Windows Explorer is required before you attempt to implement a namespace extension. It also means that you must properly enter it in the system Registry or it will not work.
As a reminder, the construction of an in-process server DLL requires the implementation of a DLL that exports the following functions:
·DllMain
·DllGetClassObject
·DllUnloadNow
The DLL also implements an object that exposes IClassFactory for the creation of the other objects contained in the DLL. Those objects will expose IUnknown and the other interfaces necessary to implement a namespace extension, including IPersistFolder, IShellFolder, IEnumIDList, and IShellView. These interfaces allow the Explorer and your extension to display, interact, and communicate.
It is important to remember that the Explorer calls into your extension by using the IShellFolder and IShellView interfaces you have implemented in your extension. The IShellBrowser interface (implemented by the Explorer), allows your extension to call back into the Explorer. It is very similar to "Site"-type interfaces commonly found in OLE scenarios.
Beyond these required interfaces, your extension will need to implement other interfaces that will be created by the IShellFolder object. These include IExtractIcon to provide icons, IContextMenu to provide context menus for your items, drag-and-drop interfaces (IDropSource and IDropTarget), and IDataObject for data transfer.
Examples of in-process server DLLs, especially any that contain namespace or shell extensions, are obviously helpful in learning to build namespace extension DLLs.