ShellBoost

Shell notification support

Whenever a Shell Item or a Shell Folder you handle is created, renamed, changed or deleted, you can, and often you should, notify the Shell of what happened. The underlying technology for this is the Windows SHChangeNotify function API. Fortunately, ShellBoost proposes two versions of easy-to-use wrappers over this API:

static overloaded methods ShellUtilities.ChangeNotify(…) in the ShellBoost.Core.Utilities.ShellUtilities class.

Instance methods NotifyUpdate, NotifyCreate, NotifyDelete and NotifyRename in the ShellItem class. The instance methods use the ShellUtilities’ ones in their implementation.

So, for example, if a Shell Item has been renamed by some internal implementation of your namespace extension, you should call the NotifyRename method of the corresponding ShellItem instance. This will instruct the Windows Shell that this item has been renamed, and it will react accordingly. For example, if this item was displayed in an Explorer view (or even multiple views), the item in question will be refreshed.

An extension that expands itself using notification events is demonstrated in the Device Manager Folder sample.

Subscribing to shell events

Depending on your scenario, you can also be interested to subscribe to events that are raised by other namespaces in the Windows Shell, including the file system itself. Fortunately, ShellBoost provides the ShellBoost.Core.Utilities.ChangeNotifier class that provides events when any part of the system, including any 3rd parties installed on the machine, uses the SHChangeNotify Shell’s native function in any other process running on the desktop.

Its usage is demonstrated in the Physical Overview sample.