Hi Sue
I working on VC++ and the toolbar is for MS Outlook 2003.
So i want to perform a task when a new contact is added.
I tried following:
extern _ATL_FUNC_INFO OnItemAddInfo;
typedef IDispEventSimpleImpl<10006,CZOLAddin, &__uuidof(Outlook::ItemsEvents)
class ATL_NO_VTABLE CZOLAddin :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CZOLAddin, &CLSID_ZOLAddin>,
public ISupportErrorInfo,
public IDispatchImpl<IZOLAddin, &IID_IZOLAddin, &LIBID_ZEBOTOOLBARLib>,
public IDispatchImpl<_IDTExtensibility2, &IID__IDTExtensibility2,
&LIBID_AddInDesignerObjects>,
public InviteButtonEvent,
public HomePageMenuButtonEvent,
public HomePageButtonEvent,
public AboutButtonEvent,
public SearchComboEvent,
public ItemEvent
then onConnection i do this:
pApp->GetNamespace(L"MAPI",&nameSpace);
if(nameSpace){
nameSpace->get_CurrentUser(&CurUser);
CurUser->get_Name(&m_CurUserName);
nameSpace->GetDefaultFolder(olFolderContacts,&mFolder);
mFolder->get_Items(&m_spItems);
m_spItems is of type _ItemsPtr.
then i advise it
ItemEvent:
ispEventAdvise((IDispatch*)m_spItems,
&__uuidof(Outlook::ItemsEvents));
the event handler is defined as :
void __stdcall CZOLAddin::OnItemAdd(IDispatch * Inspector)
{
MessageBeep(1);
}
but this does not work ..i tried keeping a break point ..but no luck.
can u guide me on this.
Regards
Rohan
}