View Single Post
  #1  
Old June 6th 06, 05:32 PM posted to microsoft.public.outlook.program_addins
pete_42
external usenet poster
 
Posts: 9
Default Crash in GetMAPIOBJECT + Outlook 2007

Hi,

I'm using the following code to get the IMAPIProp-Pointer to the
current Outlook mail window. Worked nicely so far. But when I'm testing
it with Outlook 2007 beta, the GetMAPIOBJECT call causes an exception.

If I perform the same steps as the program below does with OutlookSpy
and Outlook 2007 everything works nicely - so what am I doing wrong,
here? I'd be grateful for any ideas...

THANKS!

pete

Outlook::_InspectorPtr spInspector = m_OLAppPtr-ActiveWindow();
if (spInspector)
{
IDispatch *pd = spInspector-GetCurrentItem();
if (pd)
{
Outlook::_MailItem *pMailItem = NULL;
const GUID local_IID_IMailItem = {0x00063034,0,0,
{0xC0,0,0,0,0,0,0,0x46}};
pd-QueryInterface (local_IID_IMailItem, (LPVOID *)&pMailItem);

if (pMailItem)
{
IUnknown *iu = pMailItem-GetMAPIOBJECT(); //Crashes in
Outlook 2007 Beta
.....

Ads