Andrei Smolin

Add-in Express and Windows hooks

Once in a couple of years Microsoft contacts us on this or that topic. The last topic was the Excel performance on Windows Desktop. They demonstrated a case where enabling an Add-in Express add-in produced an astounding 90-second delay when selecting another cell while Excel was busy with some long calculation. They suggested that the hooks that Add-in Express sets produce that delay. While investigating the case, we found out that we had reported such a delay on a limited example on the Excel for Developers forum.

So, what is a Windows hook? This is a way to get informed about messages that a given window receives. Find details in Hooks at On one of the pages in that section, you'll find this note:

Hooks tend to slow down the system because they increase the amount of processing the system must perform for each message. You should install a hook only when necessary and remove it as soon as possible.

Add-in Express sets several hooks to deal with these issues and to implement these features:

  • Keyboard input. If a textbox is located on an Add-in Express pane, Excel grabs typing in that textbox and the result is: you type in an Excel cell, not in the textbox.
  • Keyboard input. Add-in Express needs to work coordinately with IME editors that are available, say, with Japan (Hiragana). A hook is required to find out if an IME editor is enabled.
  • Keyboard input. Add-in Express lets you intercept keyboard shortcuts.
  • UI. To embed a custom pane in an Excel window, Add-in Express sets a hook to get the state of the window. When the window state changes, the custom pane gets hidden, shown, sized, etc. as appropriate.
  • UI. An add-in needs to react to DPI changes. Currently, related Windows messages do not reach Add-in Express panes, and this requires us to set one more hook.

That is, some hooks are required for the functionality of Add-in Express, some are required only because of technical issues of Excel and Windows.

We supplied Microsoft with this information and with the source code of Add-in Express and now are waiting for changes; no ETA is available.

Meanwhile, we've been reported about an issue: if an Add-in Express add-in is enabled in an Outlook 2019 build that comes under the Volume License – these are quite old builds – the Move Items dialog (see Home | Move | Other folder… in Outlook Explorer windows) gets populated too slowly if you have really many folders. Moreover, using the ADXOlFormsManager component, increased the delay significantly. It has turned out that the folder tree in that dialog receives a huge lot of messages, all of which coming through the hooks set by Add-in Express. And the delay occurred despite the fact that the hook handlers ignore these messages.

We've come with this solution – it was introduced in Add-in Express version 9.5 – hooks are now set and handled in the code of the Add-in Express loader and the hook consumers (such as the ADXOlFormsManager component) communicate with the loader. That is, instead of setting hooks whenever required, Add-in Express can set hooks once and, in this way, minimize the consequences of using hooks. To use this feature, two things are required:

  • Set the UnmanagedHooks property to true; see the properties of the add-in module. By default, this property is set to false so that this feature is disabled.
  • Deploy adxloader.dll and adxloader64.dll of version 9.5 or higher. Using an older adxloader version produces a warning message shown when the add-in is loaded.

Still, you understand that the more Excel is burdened with features, the more slowly it works. We've also found that hooks in Windows 10 work slower than in Windows 7; see this page on

With all these tendencies in mind, here comes a suggestion: if you set Windows hooks in the code of your add-in, contact us so that we could discuss the design allowing you to consume the hooks set by Add-in Express.

Good luck!


  • damian says:

    You should have better used API hooking rather than CBT hooking… CBT hooking has always been a source of problems.

  • Andrei Smolin (Add-in Express Team) says:

    Hello Damian,

    We use Windows API Hooking, not CBT. If anything above suggest that we use CBT hooking, please let me know and I’ll update the text.

Post a comment

Have any questions? Ask us right now!