Outlook 2003 MailItem bug?

  • Thread starter Michael Böhnisch
  • Start date
M

Michael Böhnisch

Hi

I wrote an Outlook plugin using VC++/ATL that runs just fine with Outlook 2000 and 2002 but crashes on Outlook 2003
Here is what I do (code is inside a button callback)

CComPtr<Outlook::Selection> spSelection (correctly) holds the list of currently selected Mail Item
...
// get 1st selected MailIte
CComVariant index( 1 )
CComPtr<Outlook::_MailItem> spItem
hr = spSelection->Item( index, (IDispatch**) &spItem )
if ( FAILED( hr ) ) return

// Check if item really is an email object
enum Outlook::OlObjectClass cls
hr = spItem->get_Class( &cls )
if ( FAILED( hr ) ) return

if ( cls == Outlook::eek:lMail )
// Retrieve email subject text
CComBSTR subject
hr = spItem->get_Subject( &subject ); // <---- crash on call of get_Subject(
if ( FAILED( hr ) ) return
...


Using Visual Studio .NET 2003 debugging I get an alert box

This is kind of funny, since other COM calls before run just fine and the same code (same compiler options, same source) works on older Outlook versions

Any help is appreciated..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top