![]() |
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
|
|||
|
|||
![]()
Hi all,
I am facing one weired problem. I am adding one menu item to the right click context menu for my add-in. I pasted my function below. This function is working fine with Outlook 2002 and Outlook 2003. But it is crashing on Outlook 2000 for one specific scenario. After initializing Outlook if I right click on normal mail item and then if I right click on meeting item Outlook just crashes with the Access violation error. Only difference between these two menus are for meeting item there are more no of options in the context menu. If user does it vice versa then it works fine. ( first right click on meeting item and then mail item.) I am not able to understand this behaviour of Outlook 2000. If anyone knows about this issue, please let me know about the same. I have noted down the crash line as "*******Crash occurring here. *******" in the code. void __stdcall CIPPlugin::OnContextMenuUpdate() { CComPtrOffice::CommandBar pCmdBar; CComPtrOffice::CommandBarControls pMenuControls; Office::MsoBarProtection oldProtectionLevel; BOOL bFound =false; int Count =0; /// //m_spCommandbars is member variable of CIPPlugin class. //We are getting it in OnStartupComplete // result= pActiveExplorer-get_CommandBars(&pExplorerCommandBars); /// if( m_spCommandbars ) m_spCommandbars-get_Count(&Count); for(long i = 0; i Count; i++) { CComPtrOffice::CommandBar pTempBar; CComVariant vItem(i+1); m_spCommandbars-get_Item(vItem,&pTempBar); if(pTempBar) { BSTR bstrName; pTempBar-get_Name(&bstrName); if(!wcscmp(L"Context Menu", bstrName)) { pCmdBar = pTempBar; bFound = true; pCmdBar-Reset(); //*******Crash occurring here. ******* break; } ::SysFreeString(bstrName); } } if(!bFound) return; if(pCmdBar) { pCmdBar-get_Controls(&pMenuControls); pCmdBar-get_Protection(&oldProtectionLevel); pCmdBar-put_Protection(Office::msoBarNoProtection); CComVariant vtType(Office::msoControlButton); CComPtrOffice::CommandBarControl pContextMenuControl; pSPAMContextMenuControl=pMenuControls-Add(CComVariant( Office::msoControlButton), CComVariant(1), CComVariant(1), CComVariant(1), CComVariant(VARIANT_TRUE) ); if(pContextMenuControl==NULL) { LOG_ERR_MESSAGE(_T("pMenuControls-Add") , GetLastError()); pCmdBar.Release(); return; } pContextMenuControl-QueryInterface(&m_pContextMenu); bstrTemp.LoadString(IDS_BUTTON_CAPTION); if( m_pContextMenu ) { m_pContextMenu-put_Tag(bstrTemp); m_pContextMenu-put_Caption(bstrTemp); m_pContextMenu-put_Priority(1) ; m_pContextMenu-put_Visible(TRUE); m_pContextMenu-put_Style(Office::msoButtonIconAndCaption); hr = ContextMenuEvents: ![]() } pCmdBar-put_Protection(oldProtectionLevel); pCmdBar.Release(); } } |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Reading Pane Context Menu VBA Help | Paul | Add-ins for Outlook | 8 | August 21st 06 03:15 PM |
Add Contact context menu option | Gene Chang | Add-ins for Outlook | 2 | August 1st 06 03:31 PM |
adding a context menu in Outlook | donald | Add-ins for Outlook | 6 | May 3rd 06 01:49 PM |
How do I add a new option in the context menu(Outlook)? | Outllok - context menus aad ins | Outlook - Using Forms | 5 | March 16th 06 02:47 PM |
Context Menu not present | Mono | Outlook Express | 5 | February 7th 06 06:22 PM |