A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

OL2000 'Illegal instruction' after adding menu to ActiveMenubar



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old September 30th 07, 05:26 PM posted to microsoft.public.outlook.program_addins
Georg-Hendrik
external usenet poster
 
Posts: 3
Default OL2000 'Illegal instruction' after adding menu to ActiveMenubar

This one really puzzles me.

I'm developing an Outlook COM Add-in, C++/ATL, which is to work under
Outlook 2k - 2k7. I've simplified the code and isolated the problem in a
default VS2005 Extensibility project, of which below you can find the code
from the OnConnection method.

The project compiles fine and shows no issues under Outlook 2007.
Also in Outlook 2000, everything works fine until Close is pressed.
Then it faults with 'exception at 0x030f0db6 in OUTLOOK.EXE: 0xC000001D:
Illegal Instruction.'

It only faults if I press buttons on the toolbar (e.g. Calendar, Contacts)
before exiting.

The problem seems to involve use of the ActiveMenubar - if I add a new
CommandBar and add the ControlPopup to that, the problem does not occur.

Who can help?

Sincere regards,

Georg-Hendrik


Attachement 1: OnConnection Method (in standard VS2005 Extensibility project)

STDMETHODIMP CConnect::OnConnection(...)
{
// Default code
pApplication-QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pApplication);
pAddInInst-QueryInterface(__uuidof(IDispatch), (LPVOID*)&m_pAddInInstance);

// Isolated problem code starts here
::MessageBox(NULL, _T("Connection"), NULL, 0);

CComQIPtrOutlook::_Application soOutlook;
CComPtrOutlook::_Explorer soExplorer;
CComPtrOffice::_CommandBars soBars;
CComPtrOffice::CommandBar soActiveMenu;
CComPtrOffice::CommandBarControls soMenuItems;
CComPtrOffice::CommandBarControl soMyMenuItem;

try
{
// Get to the active Outlook menu bar controls...
soOutlook = pApplication;
soExplorer = soOutlook-ActiveExplorer();
soBars = soExplorer-GetCommandBars();
soActiveMenu = soBars-ActiveMenuBar;
soMenuItems = soActiveMenu-GetControls();

// ... and add an empty pop-up menu.
soMyMenuItem = soMenuItems-Add(msoControlPopup, vtMissing, vtMissing,
vtMissing, VARIANT_TRUE);

soMyMenuItem-Caption = _T("MyMenuItem");
soMyMenuItem-Tag = _T("my.menuitem");
}

catch (...)
{
::MessageBox(NULL, _T("BFE"), NULL, 0);
}

// The error shows regardless of the following
// few lines of code; Setting the CComPtr s to
// NULL did work for five minutes (literally...)

soMyMenuItem = NULL;
soMenuItems = NULL;
soActiveMenu = NULL;
soBars = NULL;
soExplorer = NULL;

return S_OK;
}
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding seperator to Outlook standard menu John Add-ins for Outlook 2 August 29th 07 02:40 PM
Outlook add-in - adding to the Appointments Insert menu Scott Lyon Outlook - Using Forms 3 October 9th 06 09:29 PM
Novice: Adding a menu to current menu? Peter Add-ins for Outlook 4 October 2nd 06 03:34 PM
adding a context menu in Outlook donald Add-ins for Outlook 6 May 3rd 06 01:49 PM
Adding Outlook Express to my start menu MP Boettger Outlook - General Queries 1 February 22nd 06 05:45 PM


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.