View Single Post
  #2  
Old June 6th 06, 07:40 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Crash in GetMAPIOBJECT + Outlook 2007

Where is your code running? Is it in the outook.exe process space (your code
is a COM add-in) or in a separate exe?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"pete_42" wrote in message
ups.com...
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