L
LukeV
Ok, let me start over. The code below shows that I do handle the
ExplorerClose event. Everything works like a charm with OL2002, as long as I
set m_spExplorer = NULL in OnExplorerClose(). If I don't OL2002 remains in
memory for a few seconds and OL2000 remains way longer. If I don't set
m_spExplorer = NULL, then OL2000 will crash. Crashes will occur if I change
the selection in the Folder List view, like say selecting Journal (has to be
a special folder) and then selecting Inbox.
When the crash occur, the next time OL2000 is restarted, the plugin's menu
item will be duplicated. If I do a Reset of the menu, and that I do change
the selection in the Folder List, then OL2000 won't crash!
I really don't know what to do... help!
CComPtr<Outlook::_Explorer> m_spExplorer;
OnConnection()
{
...
m_spExplorer = NULL;
CComPtr<_Explorer> spExplorer = NULL;
spApp->ActiveExplorer( &spExplorer );
ATLASSERT(spExplorer);
m_spExplorer = spExplorer;
if( spExplorer )
{
hr = spExplorer->get_CommandBars(&spCmdBars);
if(FAILED(hr))
return hr;
ATLASSERT(spCmdBars);
}
...
hr = ExplorerBeforeFolderSwitch:ispEventAdvise((IDispatch*)m_spExplorer);
if(FAILED(hr))
return hr;
hr = ExplorerClose:ispEventAdvise((IDispatch*)m_spExplorer);
if(FAILED(hr))
return hr;
...
}
OnBeforeSwitchFolder()
{
NewFolder->QueryInterface( IID_MAPIFolder, (void**)&pFolder );
m_pCurrFolder = pFolder;
UpdateUI();
}
OnExplorerClose()
{
hr = ExplorerClose:ispEventUnadvise((IDispatch*)m_spExplorer);
hr =
ExplorerBeforeFolderSwitch:ispEventUnadvise((IDispatch*)m_spExplorer);
m_spExplorer = NULL;
}
ExplorerClose event. Everything works like a charm with OL2002, as long as I
set m_spExplorer = NULL in OnExplorerClose(). If I don't OL2002 remains in
memory for a few seconds and OL2000 remains way longer. If I don't set
m_spExplorer = NULL, then OL2000 will crash. Crashes will occur if I change
the selection in the Folder List view, like say selecting Journal (has to be
a special folder) and then selecting Inbox.
When the crash occur, the next time OL2000 is restarted, the plugin's menu
item will be duplicated. If I do a Reset of the menu, and that I do change
the selection in the Folder List, then OL2000 won't crash!
I really don't know what to do... help!
CComPtr<Outlook::_Explorer> m_spExplorer;
OnConnection()
{
...
m_spExplorer = NULL;
CComPtr<_Explorer> spExplorer = NULL;
spApp->ActiveExplorer( &spExplorer );
ATLASSERT(spExplorer);
m_spExplorer = spExplorer;
if( spExplorer )
{
hr = spExplorer->get_CommandBars(&spCmdBars);
if(FAILED(hr))
return hr;
ATLASSERT(spCmdBars);
}
...
hr = ExplorerBeforeFolderSwitch:ispEventAdvise((IDispatch*)m_spExplorer);
if(FAILED(hr))
return hr;
hr = ExplorerClose:ispEventAdvise((IDispatch*)m_spExplorer);
if(FAILED(hr))
return hr;
...
}
OnBeforeSwitchFolder()
{
NewFolder->QueryInterface( IID_MAPIFolder, (void**)&pFolder );
m_pCurrFolder = pFolder;
UpdateUI();
}
OnExplorerClose()
{
hr = ExplorerClose:ispEventUnadvise((IDispatch*)m_spExplorer);
hr =
ExplorerBeforeFolderSwitch:ispEventUnadvise((IDispatch*)m_spExplorer);
m_spExplorer = NULL;
}