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

Crash in GetMAPIOBJECT + Outlook 2007



 
 
Thread Tools Search this Thread Display Modes
  #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
.....

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



  #3  
Old June 7th 06, 09:50 AM posted to microsoft.public.outlook.program_addins
pete_42
external usenet poster
 
Posts: 9
Default Crash in GetMAPIOBJECT + Outlook 2007

Dmitry Streblechenko wrote:
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?

It's an add-in.

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

Hmmm... What kind of exception is it? A COM error or something like an
access violation?

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

"pete_42" wrote in message
oups.com...
Dmitry Streblechenko wrote:
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?

It's an add-in.



  #5  
Old June 8th 06, 11:13 AM posted to microsoft.public.outlook.program_addins
pete_42
external usenet poster
 
Posts: 9
Default Crash in GetMAPIOBJECT + Outlook 2007

Dmitry Streblechenko wrote:
Hmmm... What kind of exception is it? A COM error or something like an
access violation?

Good question. I tried 3 catch'es:

catch(_com_error &)
catch (CException *)
catch (...)


The third one caught the exception. So it's probably an access
violation.

Can the pointer be wrong?
Am I doing a bad cast somehow??

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

What happens when you run your code under the debugger? Did you set "break
on exception" for all exceptions in Debug | Exceptions dialog?

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

"pete_42" wrote in message
ups.com...
Dmitry Streblechenko wrote:
Hmmm... What kind of exception is it? A COM error or something like an
access violation?

Good question. I tried 3 catch'es:

catch(_com_error &)
catch (CException *)
catch (...)


The third one caught the exception. So it's probably an access
violation.

Can the pointer be wrong?
Am I doing a bad cast somehow??



 




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
How can I insert an address from Outlook 2007 into Word 2007? Ron Perry Outlook - Using Contacts 2 June 6th 06 04:24 AM
Replying to a message induces Outlok to crash - Outlook 2007 beta Ben Outlook - Installation 2 June 3rd 06 07:04 PM
Outlook crash with new MSN Messenger Dianne Outlook Express 0 May 15th 06 07:28 AM
Outlook Crash webmaster Outlook - General Queries 0 February 24th 06 06:12 PM
Outlook Crash on Close? Mahmoud Outlook - General Queries 1 January 31st 06 11:26 AM


All times are GMT +1. The time now is 01:34 PM.


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.