I'm lurking through the very few samples of native Word addins available, trying to find the way to reconstruct VSTO's Document.OnBeforeClose event.
Currently, I figured out that IDTExtensibility2
has a reference to DTE
, and that DTE
is a same COM-based approach used for Visual Studio extensions.. (so if I'll find a working C++-written VS add-in with same kind of hooks, it will solve my problems fast.)
This was taken from TestAddin2
sample from 2000's:
BEGIN_COM_MAP(CConnect)
COM_INTERFACE_ENTRY2(IDispatch, IRibbonCallback)
COM_INTERFACE_ENTRY(IConnect)
COM_INTERFACE_ENTRY(_IDTExtensibility2)
COM_INTERFACE_ENTRY(_FormRegionStartup)
COM_INTERFACE_ENTRY(IRibbonExtensibility)
COM_INTERFACE_ENTRY(IRibbonCallback)
END_COM_MAP()
So currently I wonder:
- how to acquire a proper ENTRY* parameters for capturing document-level events from within Word?
- what interface(s) should be implemented to support that?
- how to properly implement callback functions (ones that are passed to com object as 'handlers' in VSTO) in pure C++ COM?
- is there anything to generate headers from existing COM object, like VS does when showing COM object fields/props?
It seems that at least someone on SO managed to write a native-code addin (packaging a COM addin for deployment), so I'm really expecting help here.