How can I restart an Outlook COMAddin from an external C++ program?

  • Thread starter Thread starter Ken Slovak - [MVP - Outlook]
  • Start date Start date
K

Ken Slovak - [MVP - Outlook]

The AddInMon source isn't available but what it does is use Win32 API calls
to check for a window that is only present in the collection of windows for
the Outlook thread when Outlook has a UI.

It remains in memory checking for that window until it appears and then
reinitializes any COM addins that have an AddInMon DWORD in their registry
settings under addin.Connect.

You can use Spy++ to monitor and see what windows are in existence with and
without a UI and then write your own code to look for that window at
intervals you decide on.

Outlook.Application.COMAddIns is the collection you want. Each member is an
Office.COMAddIn object. Using code like this will toggle the Connect bit of
the COMAddIn object:

objOL.COMAddIns.Item("myAddin.Connect").Connect = True

"myAddin.Connect" would be the ProgID property of that specific COM addin.
You can iterate the COMAddIns collection and see the ProgID properties for
all installed addins if you want. In this case "objOL" would be an
Outlook.Application object.
 
Hi

Re. Update to my very brief query 29 July 2004

I have written an Outlook COMAddin which functions correctly but suffers
from the usual problems when external mobile devices are synchronized (I
need the AddIn to work with Outlook 2000 and later). I have looked at the
MicroEye AddInMon, which, whilst helpful (in that it does what I want) I
can't use it my application because the source code is not available (this
application has to go through external test-houses and we have to prove
provenance and security of all code we use unless the manufacturer has a
very large number of deployed installations e.g. Microsoft).

In my application, I always have another process running (an exe) that
interacts continuously with the OutlookAddin and could be used to restart
the AddIn if the AddIn was initially started by invoking Outlook without the
UI e.g. synchronization. Hence my question, how can I restart an Outlook
COMAddIn from an external C++ application.?

I have tried to create an automation project to allow me to get at the
COMAddIns collection. So far, I have not managed to get hold of the
collection and I don't have any examples of how to restart the AddIn. I
have found almost zero documentation on this topic.

I would be grateful for advice on how to get hold of the COMAddins
collection (even if this is the wrong route to restart the AddIn, I would
like to expand my knowledge) and more specifically, I would appreciate some
ideas on how to restart the AddIn.

Many thanks

Philip
 
Ken

Many thanks, this was most helpful. I have built a test cell and have
successfully managed to restart my AddIn. Thank you for coming back so
quickly.

Best regards

Philip
 
Back
Top