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: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..
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: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..