Physical vs Virtual Items
An instance of the ShellItem class represents an item in the folder view. A Shell item also can represent a folder. The CBFS Shell's ShellFolder class derives from the ShellItem class and is used to represent folders in the Shell.
In most CBFS Shell projects, you will have to create subclasses of ShellItem and ShellFolder classes to represent your custom items and folders.
From a functional and technical perspective, CBFS Shell supports two fundamental types of ShellItem (or ShellFolder because a ShellFolder is a ShellItem) instances:
A ShellItem associated with a physical filesystem path (file or folder). In this case:
- The FileSystemPath property must be set to a non-null value.
- Many properties can be automatically computed from the associated physical file.
- Item content can be modified in-place by applications.
A ShellItem not associated with any physical path and the item is completely virtual. In this case:
- The FileSystemPath property must set to a null value.
- All properties must be provided.
- Item content cannot be modified in-place by applications.
When choosing virtual or physical Shell items, remember the following key points:
- A Shell folder may contain any combination of virtual and physical Shell items.
- Even if you choose a physical Shell item, you still will be able to change many of its properties. How the end user will view and use such an item will be controlled by your extension to a certain point. For example, you may hide physical shell items from your extension.
- A physical Shell item benefits from a better automatic Shell integration, in general. For example, many third-party context menu handlers will add menu items to Shell items that are backed by a physical file.
- A physical Shell item has much better support for custom applications (e.g., Office applications, Notepad).
- CBFS Shell does not support in-place modification of virtual Shell items content. The end user will be able to open a virtual Excel file, for example, but will not be able to save it to the same shell location.
- Because virtual Shell items don't need to have a corresponding physical file nor directory, they can support custom file names with characters usually forbidden for standard physical files (e.g., < > :). This can be important when displaying items from an external source.
For example, you may show the same virtual PDF file with the exact same name to all users, and the content of the file will differ each time the user opens it with Explorer. The virtual files are opened by