Exposing Events From Non-VSTO Add-in Automation Objects

I posted a while back about exposing an automation object from an add-in that fires events. That post was couched in terms of VSTO add-ins. A customer asked recently how the same technique could be used in a non-VSTO add-in. So, that’s the topic of this post. First, here’s my automation object and the interfaces…

1

Launching Office Apps Programmatically

There are at least 9 different ways to start or connect to an Office app programmatically in managed code, as summarized in this table: PIA Interop Using the Office PIAs is the most RAD approach, with the greatest level of design-time and compile-time support. This has to be the preferred approach for almost all scenarios….

3

Passing Objects to Exposed Add-in Methods

I’ve posted a few times on the best way to expose methods from an add-in to automation clients – for example, here, here and here. So far, in my examples, I’ve described very simple exposed methods that take no parameters – but what happens if you want to expose a method that does take one…

3

Implementing IMessageFilter in an Office add-in

First a warning: this is an advanced scenario, and you should not attempt to use this technique unless you’re sure you know what you’re doing. The reason for this warning is that while the technique described here is pretty simple, it’s also easy to get wrong in ways that could interfere significantly with the host…

13

Exposing Events from Managed Add-in Objects

Following on from my recent posts on exposing add-in objects, here and here, it occurred to me that its sometimes useful to be able to expose events from these objects. Recall that you can expose your add-in through the COMAddIn.Object property in the Office OM, either directly (in a non-VSTO add-in) or through VSTO’s RequestComAddInAutomationService…

8

AddInSpy – Diagnosing/Troubleshooting Office Add-ins

AddInSpy is a new diagnostic tool for reporting the maximum possible information about all Office add-ins registered on a machine. This is a free (unsupported) download, available on MSDN Code Gallery here. Covering article on MSDN here. In fact, there are 2 tools: AddInSpy, which is a WPF GUI application, and AS, which is a…

15

COM Shim Wizard 2.3.1.0

We’ve released a slight update to the COM Shim Wizard. This is available as a free download here, and the covering article is on MSDN here. The differences Between v2.3.0.0 and v2.3.1.0 are summarized below. Setup The major difference between v2.3.0.0 and v2.3.1.0 is that v2.3.0.0 was built to install with Visual Studio 2005, whereas…

33

COMAddIns Race Condition

You can expose an arbitrary object from your add-in as a kind of extension to the Office host application’s object model. To do this, you set your object as the value of the Object property on the COMAddIn object that represents your add-in in the host’s COMAddIns collection object. You can do this directly in…

2

Why your COMAddIn.Object should derive from StandardOleMarshalObject

In general, it is important that any code in a managed Office add-in should execute on the main UI thread. The reason for this is that there are several components that simply will not work when executed from any other but the main UI thread – examples include calls on WinForms controls, and calls into…

14

Demand-Loading VSTO Add-ins

In an earlier post, I talked about how you could delay (or prevent) the loading of managed code using a native add-in. In that post I also listed the standard LoadBehavior settings, and I was assuming that everyone knows how these apply, but I got a couple of follow-up questions that prompted me to clarify…

8