finder2006
April 23rd, 2007, 01:32 PM
I need handle outlook event - save message in Draft folder
I use next code
//uuid for dispinterface ApplicationEvents Outlook(Microsoft Outlook 11.0 Object Library)
const IID IID_IOutlookEvents = {0x0006304E,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
//uuid for dispinterface ItemEvents Outlook(Microsoft Outlook 11.0 Object Library)
const IID IID_IOutlookEvents1 = {0x0006303A,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
STDMETHODIMP CAddinConnect::nConnection(IDispatch *pApplication, ext_ConnectMode ConnectMode, IDispatch *pAddInInst, SAFEARRAY ** /*custom*/ )
{
HRESULT hr = S_OK;
pApplication->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
pAddInInst->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pAddInInstance);
CComQIPtr <IConnectionPointContainer, &IID_IConnectionPointContainer> pConnPtContainer(pApplication);
if (pConnPtContainer == NULL)
return E_INVALIDARG;
// Find the connection point for events that you are interested in.
if (SUCCEEDED(hr = pConnPtContainer->FindConnectionPoint(IID_IOutlookEvents, &m_pOutlookConnectionPoint)))
{
m_pOutlookAppEventsListener = new COutlookEventsListener();
m_pOutlookAppEventsListener->AddRef();
hr = m_pOutlookConnectionPoint->Advise(m_pOutlookAppEventsListener, &m_dwOutlookConnectionCookie);
}
if (SUCCEEDED(hr = pConnPtContainer->FindConnectionPoint(IID_IOutlookEvents1, &m_pOutlookConnectionPoint1)))
{
m_pOutlookAppEventsListener1 = new COutlookEventsListener1();
m_pOutlookAppEventsListener1->AddRef();
hr = m_pOutlookConnectionPoint1->Advise(m_pOutlookAppEventsListener1, &m_dwOutlookConnectionCookie1);
}
return S_OK;
}
I can find connection point for IID_IOutlookEvents and I can handle ItemSend event, but I can't find connection point for IID_IOutlookEvents1. Tell me please, what I must do this ?
I use next code
//uuid for dispinterface ApplicationEvents Outlook(Microsoft Outlook 11.0 Object Library)
const IID IID_IOutlookEvents = {0x0006304E,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
//uuid for dispinterface ItemEvents Outlook(Microsoft Outlook 11.0 Object Library)
const IID IID_IOutlookEvents1 = {0x0006303A,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}};
STDMETHODIMP CAddinConnect::nConnection(IDispatch *pApplication, ext_ConnectMode ConnectMode, IDispatch *pAddInInst, SAFEARRAY ** /*custom*/ )
{
HRESULT hr = S_OK;
pApplication->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
pAddInInst->QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pAddInInstance);
CComQIPtr <IConnectionPointContainer, &IID_IConnectionPointContainer> pConnPtContainer(pApplication);
if (pConnPtContainer == NULL)
return E_INVALIDARG;
// Find the connection point for events that you are interested in.
if (SUCCEEDED(hr = pConnPtContainer->FindConnectionPoint(IID_IOutlookEvents, &m_pOutlookConnectionPoint)))
{
m_pOutlookAppEventsListener = new COutlookEventsListener();
m_pOutlookAppEventsListener->AddRef();
hr = m_pOutlookConnectionPoint->Advise(m_pOutlookAppEventsListener, &m_dwOutlookConnectionCookie);
}
if (SUCCEEDED(hr = pConnPtContainer->FindConnectionPoint(IID_IOutlookEvents1, &m_pOutlookConnectionPoint1)))
{
m_pOutlookAppEventsListener1 = new COutlookEventsListener1();
m_pOutlookAppEventsListener1->AddRef();
hr = m_pOutlookConnectionPoint1->Advise(m_pOutlookAppEventsListener1, &m_dwOutlookConnectionCookie1);
}
return S_OK;
}
I can find connection point for IID_IOutlookEvents and I can handle ItemSend event, but I can't find connection point for IID_IOutlookEvents1. Tell me please, what I must do this ?