Outlook 11 object model not compatible with Outlook 10???...

Z

Zhenxin Li

Hello,

I write an addin(C++) for Outlook 10. It catchs NewInsepctor event and add a
new toolbar button for the new inspector.

When I install this addin on Outlook 11. The addin fails when it advise
event sink for NewInspector event.

The following is a piece of codes.

void __stdcall CConnect::OnNewInspector(IDispatch* /*Outlook::_Inspector* */
pCtrl)
{
HRESULT hResult;

CComQIPtr<Outlook::_Inspector> pInspector(pCtrl);

CComQIPtr<IConnectionPointContainer> pInspectorCPC;
CComPtr<IConnectionPoint> pInspectorCP;

DWORD dwCookie;

// Advise InspectorEvents sink...
pInspectorCPC = pInspector;
if ( pInspectorCPC == NULL )
{
ATLTRACE2("CConnect::OnNewInspector: Failed get connection point container
for inspector!\n");

return;
}

if ( FAILED(hResult =
pInspectorCPC->FindConnectionPoint(__uuidof(Outlook::InspectorEvents),
&pInspectorCP)) )
{
ATLTRACE2("CConnect::OnNewInspector: Failed get connection point for
inspector!\n");

return;
}

if ( FAILED(hResult =
pInspectorCP->Advise((IUnknown*)m_pInspectorEventsHandler, &dwCookie)) )
{
ATLTRACE2("CConnect::OnNewInspector: Failed advise event sink for
inspector!\n");

return;
}

/**************** Above "if" Failed!!!!!!!!!!!!! ****************/
....
}

Isn't Outlook 11 object model compatible with Outlook 10?

Thanks!
zxli
 
Z

Zhenxin Li

I've solved the problem.

Something wrong with the usage of m_pInspectorEventsHandler(a handler class
that derived IDispath). Reference count reaches zero during the
pInspectorCP->Advise call.

zxli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top