Mind the (ECE) Gap

We’ve added a couple new C++ only events to Outlook 2010 which I have been asked to document. These events were added per customer request to help fill some gaps in the transition from ECE to Com Add-In. One of the events is available as of the October 2011 Cumulative Update, and the other just shipped in the February 2012 Cumulative Update.

The two new events are:

Interface

Event

Dispid

Hotifx Package

Notes

Application

BeforePrint

0xFC8E

KB2596485

Fired from the Application object prior to any printing operation.

Item

ReadComplete

0xFC8F

KB2597137

Fires at the same time as the old ECE OnReadComplete event.

If you’re familiar with writing Exchange Client Extensions and Com Add-Ins in C++, this is likely sufficient information to handle these events. If not, you might want to review some samples which demonstrate handling events from the IDispatch::Invoke function. For example, I found this add-in on codeproject which handles Application events. In that code, the CAppEventListener::Invoke function is where you would handle the BeforePrint event.

Some notes:

  • Both of these events are cancellable. The first parameter is of type VT_BOOL|VT_BYREF. Return VARIANT_TRUE in this parameter to cancel the operation being signaled by the event.
  • BeforePrint has an extra second parameter. This is a mistake on our part, which unfortunately cannot be corrected. Just ignore it.
  • I characterize these as C++ only events to stress that they are not part of the type library and therefore not exposed to languages and frameworks which handle IDispatch for you. You can handle these events if you implement IDispatch directly, which may be possible from languages other than C++.

Enjoy!