"Ken Slovak - [MVP - Outlook]" wrote:
In On_Connection you first need to check if there are any Explorers at all,
Outlook can be started using automation with no UI (think ActiveSynch). You
need to maintain a count or collection of Explorers and Inspectors and
handle the Inspector.Close and Explorer.Close events. In those events if the
counts of the collections is = 1 you know Outlook wants to close down. At
that point you need to release all objects that are being retained so the
On_Disconnection event will fire.
That's one of the problems I'm looking for help on - how to "release" the
objects...
In my OnConnection I'm saving a pointer to the Application and
ActiveExplorer objects - I haven't yet figured out why my NewExplorer
callback hasn't been triggered but since in my testing I only have the one
instance of outlook running I figured that wasn't too surprising - anyway, in
my OnClose() I'm calling Release() on the application object
(m_spApp-GetApplication()-Release()

but if I try to call Release on the
explorer object (m_spExplorer-Release()

, I get a 'cannot access private
member declared in class ...
error from the compiler. I got the same error from the release of the
application before I found the GetApplication() method. What's the correct
way to "release" the objects?