Shell Notifications

Whenever a Shell item or a Shell folder that you handle is created, renamed, changed, or deleted, you can, and often should, notify the Shell about what happened. The underlying technology for this process is the corresponding Windows API: SHChangeNotify function. CBFS Shell provides two versions of easy-to-use wrappers over this API:

  • Static overloaded ShellUtilities.ChangeNotify***() methods in the callback.ShellBoost.Core.Utilities.ShellUtilities class.
  • Instance methods NotifyUpdate, NotifyCreate, NotifyDelete, and NotifyRename in the ShellItem class. The instance methods use the ShellUtilities methods in their implementation.

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 Shell that this item has been renamed, and Shell 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 also may be interested in subscribing to events that are raised by other Namespaces in the Shell, including the filesystem itself. Fortunately, CBFS Shell provides the callback.ShellBoost.Core.Utilities.ChangeNotifier class. This class fires events when any part of the system, including any third parties installed on the machine, uses the SHChangeNotify Windows API function in any other process that is running on the desktop. Usage of this class is demonstrated in the Physical Overview sample.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Shell 2022 .NET Edition - Version 22.0 [Build 8172]