File Explorer (Windows) - Extensibility

Extensibility

File Explorer can be extended to support non-default functionality by means of Windows Shell Extensions, which are COM objects that plug the extended functionality into Windows Explorer. Shell extensions can be in the form of shell extension handlers, toolbars or even namespace extensions that allow certain folders (or even non-filesystem objects such as the images scanned by a scanner) to be presented as a special folder. File Explorer also allows metadata for files to be added as NTFS Alternate Data Streams, separate from the data stream for the file.

Shell extension handlers are queried by the shell beforehand for modifying the action the shell takes. They can be associated on a per-file type basis - where they will show up only when a particular action takes place on a particular file type - or on a global basis - which are always available. The shell supports the following extension handlers:

Handler Description Can be implemented on Required shell version
Context menu handler Adds menu items to the context menu. It is called before the context menu is displayed. Per-file type basis Windows 95 and later. Windows 7 introduced IExecuteCommand
Drag-and-drop handler Controls the action upon right-click drag and drop and modifies the context menu that appears. Global basis Windows 95 and later
Drop target handler Controls the action after a data object is dragged and dropped over a drop target such as a file. Per-file type basis Windows 95 and later
Data object handler Controls the action after a file is copied to the clipboard or dragged and dropped over a drop target. It can provide additional clipboard formats to the drop target. Per-file type basis Windows 95 and later
Icon handler Assigns a custom icon to an individual file amongst a class of file types. It is called before file icons are displayed. Per-file type basis Windows 95 and later
Property sheet handler Replaces or adds pages to the property sheet dialog box of an object. Per-file type basis Windows 95 and later
Copy hook handler Allows running, modifying or denying the action when a user or application tries to copy, move, delete, or rename an object. Not associated with a file type Windows 95 and later
Search handler Allows shell integration of a custom search engine. Not associated with a file type Windows 95 and later up to Windows XP
Infotip handler Allows retrieving flags and infotip information for an item and displaying it inside a popup tooltip upon mouse hover. Per-file type basis Windows Desktop Update and later
Thumbnail image handler Provides for a thumbnail image to be generated and displayed along with its alpha type when a file is selected or the thumbnail view is activated. Per-file type basis Windows Desktop Update and later. Windows Vista introduced a newer IThumbnailProvider interface that also shows thumbnails in the Details pane. The older IExtractImage is still supported but not in the Details pane.
Disk Cleanup handler Add a new entry to the Disk Cleanup application and allows specifying additional disk locations or files to clean up. Per-folder basis Windows 98 and later
Column handler Allows creating and displaying custom columns in Windows Explorer Details view. It can be used to extend sorting and grouping. Per-folder basis Windows 2000, Windows Me, Windows XP & Server 2003
Icon overlay handler Allows displaying an overlay icon over a shell object (a file or folder icon). Per-file type basis Windows 2000 and later
Metadata handler Allows viewing and modifying metadata stored in a file. It can be used to extend details view columns, infotips, property pages, sorting and grouping. Per-file type basis Windows 2000 and later
Filter handler (IFilter) Allows file properties and its contents to be indexed and searched by Indexing Service or Windows Search Per-file type basis Windows 2000 and later
AutoPlay handler Examines newly discovered removable media and devices and, based on content such as pictures, music or video files, launches an appropriate application to play or display the content. Per file type category. In Windows XP only, per-device and per file type category. Windows XP and later
Property handler Allows viewing and modifying system-defined and custom properties of a file. Per-file type basis Windows Vista and later, on Windows XP if Windows Search is installed.
Preview handler Renders enhanced previews of items without launching the default application when a file is selected. It can also provide file type-specific navigation such as browsing a document, or seeking inside a media file. Per-file type basis Windows Vista and later

Namespace extensions are used by Explorer to either display some data - which are not persisted as files - in a folder-like view or to present data in a way that is different from their organization on the file system. This feature can be exploited by a Relational File System like liquidFOLDERS or Tabbles, clones of the ill-fated Microsoft WinFS. Special Folders, such as My Computer and Network Places in Windows Explorer are implemented this way, as are Explorer views that let items in a mobile phone or digital camera be explored. Source-control systems that use Explorer to browse source repositories also use Namespace extensions to allow Explorer to browse the revisions. To implement a namespace extension, the IPersistFolder, IShellView, IShellFolder, IShellBrowser and IOleWindow interfaces needs to be implemented and registered. The implementation needs to provide the logic for navigating the data store as well as describing the presentation. Windows Explorer will instantiate the COM objects as required.

While Windows Explorer natively exposes the extensibility points as COM interfaces, .NET Framework can also be used to write extensions, using the COM Interop functionality of .NET Framework. While Microsoft itself makes available extensions - such as the Photo Info tool - which are authored using .NET Framework, they currently recommend against writing managed shell extensions, as only one instance of the CLR (prior to version 4.0) can be loaded per-process. This behavior would cause conflicts if multiple managed add-ins, targeting different versions of the CLR, are attempted to be run simultaneously.

Read more about this topic:  File Explorer (Windows)