Which method is fired when Outlook closes ?

  • Thread starter Thread starter A. Tam
  • Start date Start date
A

A. Tam

Hello,

I have a problem with my COM Addin. It causes Outlook to
stay in memory because some interfaces are not released. I
release them in OnDisconnection, but it does not work.

Where should I release these interfaces ?

Thank you for your kind responses

Arnaud
 
On_Disconnection is a Catch 22 event. It won't fire unless all your Outlook
objects have already been released. You will need to monitor for the
Explorer and Inspector Close events and release all your objects when the
last Explorer/Inspector is closing.

See the VB 6 COM addin template ItemsCB for code that does that and works
around various other Outlook bugs. That can be downloaded from the Resources
page at www.microeye.com
 
I am using VC++ and this VB Code is not very helpfull to me.

Should it be that I would have to monitor every Explorer or
Inspector creation to attach the Event handler for Close to
each newly created Explorer/Inspector ?
 
Yes. In VB terms we create a class that is instantiated each time a new
Inspector or Explorer is opened. A separate class for each. We then store
those in a collection. In the class modules we handle events for the
Inspector or Explorer in the class. That way we handle correctly events for
separate items. When there are no more Explorers or Inspectors (check for
Explorers by looking for an ActiveExplorer) then we release all Outlook
objects and then On_Disconnection will fire.
 
Back
Top