A
Antonio Casilias
Hi,
I have outlook add-in (toolbar) that works properly when I launch main MS
Outlook application.
But if I launch Send To -> Mail Recipient from explorer's context menu I
take Debug assertion failed and my add-in crashes.
This is sample of OnConnection event handler code:
STDMETHODIMP CAddin::OnConnection(IDispatch * Application,
ext_ConnectMode ConnectMode,
IDispatch * AddInInst, SAFEARRAY * *
custom)
{
CComPtr < Office::_CommandBars> spCmdBars;
CComPtr < Office::CommandBar> spCmdBar;
// QI() for _Application
CComQIPtr spApp(Application);
ATLASSERT(spApp);
// get the CommandBars interface that represents Outlook's
//toolbars & menu items
CComPtr spExplorer;
spApp->ActiveExplorer(&spExplorer);
HRESULT hr = spExplorer->get_CommandBars(&spCmdBars);
if(FAILED(hr))
return hr;
ATLASSERT(spCmdBars);
//etc
<..>
}
The error occured on
HRESULT hr = spExplorer->get_CommandBars(&spCmdBars);
Could you advice me how to determine if not main window has opened to avoid
this error?
Sorry, for my bad english.
Thanks in advance.
I have outlook add-in (toolbar) that works properly when I launch main MS
Outlook application.
But if I launch Send To -> Mail Recipient from explorer's context menu I
take Debug assertion failed and my add-in crashes.
This is sample of OnConnection event handler code:
STDMETHODIMP CAddin::OnConnection(IDispatch * Application,
ext_ConnectMode ConnectMode,
IDispatch * AddInInst, SAFEARRAY * *
custom)
{
CComPtr < Office::_CommandBars> spCmdBars;
CComPtr < Office::CommandBar> spCmdBar;
// QI() for _Application
CComQIPtr spApp(Application);
ATLASSERT(spApp);
// get the CommandBars interface that represents Outlook's
//toolbars & menu items
CComPtr spExplorer;
spApp->ActiveExplorer(&spExplorer);
HRESULT hr = spExplorer->get_CommandBars(&spCmdBars);
if(FAILED(hr))
return hr;
ATLASSERT(spCmdBars);
//etc
<..>
}
The error occured on
HRESULT hr = spExplorer->get_CommandBars(&spCmdBars);
Could you advice me how to determine if not main window has opened to avoid
this error?
Sorry, for my bad english.
Thanks in advance.