![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I'm (trying to) program an addin in VC++ (VS 2005) for Outlook 2003
How do I catch the event when the user clicks a button within the menu? Is there a way to DispEventAdvise for the Office::CommandBarControls or the Office::CommandBarPopup which "owns" the menu items? My addin has a toolbar, which has a menu (Office::msoControlPopup). I am able to listen to events when the user clicks on a button in my toolbar, but not when we clicks on a menu item(Office::msoControlPopup) in the toolbar what should i do to listen to that event when user clicks on a menu in my toolbar. Here is my sample code: I have created a CEventWrapper class which implements IDispEventSimpleImpl Interface. CEventWrapper.h //Implemented a class from IDispEventSimpleImpl class CEventWrapper ![]() Office::_CommandBarButtonEvents) { public: CEventWrapper (void); CEventWrapper ( Outlook::_ExplorerPtr spExplrPtr, Office:: _CommandBarButtonPtr spCmdBrBtnPtr); CEventWrapper (void); Office::_CommandBarButtonPtr m_spCmdBrBtnPtr; } typedef IDispEventSimpleImpl CEventWrapper.h&__uuidof(Office:: _CommandBarButtonEvents) CmdBarBtnEvnts; //Implemented Sink map. BEGIN_SINK_MAP CEventWrapper SINK_ENTRY_INFO(1, __uuidof(Office::_CommandBarButtonEvents),0x1, OnButtonClick , &OnButtonClickInfo) END_SINK_MAP() HRESULT __stdcall OnButtonClick(LPDISPATCH lpBtnDisp, VARIANT_BOOL *vbCancelDefault) { //Event Handler } CEventWrapper.cpp _ATL_FUNC_INFO OnButtonClickInfo ={CC_STDCALL,VT_EMPTY,2,{VT_DISPATCH,VT_BOOL} }; CEventWrapper ( Outlook::_ExplorerPtr spExplrPtr, Office:: _CommandBarButtonPtr spCmdBrBtnPtr) { CmdBarBtnEvnts: ![]() to the event source. } HRESULT __stdcall CButtonWrapper::OnButtonClick(LPDISPATCH lpBtnDisp, VARIANT_BOOL *vbCancelDefault) { //B. Logic. } Adding "Office::msoControlPopup" to the toolbar. { //Added from a different class in "OnConnection".. Office::CommandBarControlPtr spCmdBrCtrlPtr; Office::CommandBarControlsPtr spCmdBrCtrlsPtr spCmdBrCtrlPtr = spCmdBrCtrlsPtr-Add( vCtrlTyp, vMissng,vMissng,vMissng, vIsTempry); HRESULT hr = spCmdBrCtrlPtr-QueryInterface( __uuidof( Office:: CommandBarPopup), (void**)&m_spCmdBrPopupPtr); spCmdBrCtrlPtr = m_spCmdBrPopupPtr-Controls-Add(vCtrlTypBtn, vMissng, vMissng, vMissng, vIsTempry); CmdBarBtnEvnts: ![]() } Thanks in Advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Capturing Send/Receive events in VSTO add-in | Aakash Polra | Outlook - General Queries | 1 | September 30th 08 05:49 PM |
Unable to install Outlook 2007/unable to uninstall Office 97, 2000 | Chezritz | Outlook - Installation | 3 | November 4th 07 04:02 AM |
Unable to dismiss recurring calendar events when using Outlook Con | J Austin | Outlook - Calandaring | 0 | December 24th 06 04:35 PM |
I am unable to open existing or create new events within calendar | joe f | Outlook - Calandaring | 0 | July 25th 06 04:00 PM |
unable to add events to my calendar. | Lee Richardson | Outlook - Calandaring | 1 | March 8th 06 07:09 PM |