How Extensions Work

When Microsoft Exchange is started on 16-bit versions of Windows, it reads a list of extensions from the .INI file. On 32-bit Windows NT or Windows 95, each extension registers a DLL name, an ordinal, and a map indicating in which contexts it wants to be called in the registry database. Next, it activates all the extensions that are registered to participate within the EECONTEXT_TASK context. Later, extensions that participate in other contexts are activated as needed when those contexts become current.

After Microsoft Exchange and its initial extensions have been loaded into memory, the interaction between Microsoft Exchange and its extensions is determined mostly by the user's interaction with Microsoft Exchange, but it can also be determined by events such as the arrival of a new message.

The following steps give an overview of how Microsoft Exchange interacts with its extensions:

  1. A context activation occurs.
  2. In the order in which they are listed in the .INI file or registry, Microsoft Exchange invokes the IExchExt::Install method on each extension object that has registered to participate in the new context. One of the parameters passed to each extension through Install is a pointer to a callback object that supports the IExchExtCallback : IUnknown interface.
  3. Each extension that was called in step 2 uses IExchExtCallback to retrieve information about the environment, including the active menu, the active toolbar, the number of objects selected in the current window, and the entry identifier of the selected item. Extensions can also use MAPI and Windows API functions to retrieve information. Extensions use this information to determine if they will participate in the new context.
  4. If an extension determines that it will participate in the context, it will return S_OK from IExchExt::Install. For example, an extension might need to participate in a context only if a certain folder is open. Otherwise, it returns S_FALSE.
  5. In the order in which they are listed in the .INI file or registry, Microsoft Exchange invokes appropriate methods on all extensions that returned S_OK. The methods that are invoked depend on the context. For example, if the context is EECONTEXT_SENDNOTEMESSAGE, Microsoft Exchange first invokes the IExchExtCommands::InstallCommands method on all extensions that are registered to participate in this context and which implement the IExchExtCommands : IUnknown interface. Extensions can then add menu items to an existing menu and enable or disable them using Windows API calls.