O
optimist
And I'm apparently suffering from a common problem - how to get Outlook to
shutdown after my add-in is installed. I've flailed for a couple of days,
now it's time to ask for help. I've gleaned that I need to somehow close or
release or free something in the OnClose event for the Explorer, but what and
how is that done? I've tried doing
appPtr->GetApplication()->Release()...which doesn't seem to have any effect.
Here's the OnConnection() code where some of the initialization code lives,
if it helps to point out my failures...
STDMETHODIMP CConnect::OnConnection(IDispatch *pApplication,
AddInDesignerObjects::ext_ConnectMode ConnectMode, IDispatch *pAddInInst,
SAFEARRAY ** /*custom*/ )
{
pApplication->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
CComQIPtr <Outlook::_Application> spApp(pApplication);
ATLASSERT(spApp);
m_spApp = spApp;
CComPtr<Outlook::_Explorer> spExplorer;
spExplorer = spApp->ActiveExplorer();
m_spExplorer = spExplorer;
ExpEvents:ispEventAdvise((IDispatch*)m_spExplorer,&__uuidof(Outlook::ExplorerEvents));
AppEvents:ispEventAdvise((IDispatch*)m_spApp,&__uuidof(Outlook::ApplicationEvents));
return S_OK;
}
shutdown after my add-in is installed. I've flailed for a couple of days,
now it's time to ask for help. I've gleaned that I need to somehow close or
release or free something in the OnClose event for the Explorer, but what and
how is that done? I've tried doing
appPtr->GetApplication()->Release()...which doesn't seem to have any effect.
Here's the OnConnection() code where some of the initialization code lives,
if it helps to point out my failures...
STDMETHODIMP CConnect::OnConnection(IDispatch *pApplication,
AddInDesignerObjects::ext_ConnectMode ConnectMode, IDispatch *pAddInInst,
SAFEARRAY ** /*custom*/ )
{
pApplication->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
CComQIPtr <Outlook::_Application> spApp(pApplication);
ATLASSERT(spApp);
m_spApp = spApp;
CComPtr<Outlook::_Explorer> spExplorer;
spExplorer = spApp->ActiveExplorer();
m_spExplorer = spExplorer;
ExpEvents:ispEventAdvise((IDispatch*)m_spExplorer,&__uuidof(Outlook::ExplorerEvents));
AppEvents:ispEventAdvise((IDispatch*)m_spApp,&__uuidof(Outlook::ApplicationEvents));
return S_OK;
}