View Single Post
  #4  
Old October 29th 07, 09:55 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook 2007 crash

You never initialize the i variable in UpdateSelection(). Are you usre it is
valid?

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

"Zuber" wrote in message
...
Hello Dmitry,

On further investigation I found that with Outlook 2003, the events are
fired the same way as for Outlook 2007. For OL2003, the events that are
fired
on folder change a

1. OnSelectionChange() for mail from previous folder
2. OnSelectionChange() for new folder
3. OnSelectionChange() form mail in new folder

On OL2007, only the first event is fired.

Here is a skeleton of the code:

OnSelectionChange( LPEXCHEXTCALLBACK lpeecb )
{
CComQIPtrIUnknown, &IID_IUnknown spUnk = lpeecb;
UpdateSelection(spUnk);
}

UpdateSelection(LPEXCHEXTCALLBACK lpeecb)
{
CComPtrIExchExtCallback m_spExchCallback;
m_spExchCallback = lpeecb;
m_spExchCallback-GetSelectionItem ( i ,&cbEID, &pEID, &ulType,
szMsgClass,

SOTC_MSGCLASS_SIZE,
&dwMsgFlags,
0) );
if ( MAPI_MESSAGE == ulType )
{
AddItem(pNewSelection);
}
}

If I comment out, GetSelectionItem() it works properly otherwise OL
crashes.

The "LPEXCHEXTCALLBACK" comes from the Exchange55 SDK. Is the Exchange55
SDK
compatible with OL 2007 ?

Thanks and Regards,

Zuber

"Dmitry Streblechenko" wrote:

I don't think I have ever seen this. What is your code? How do you
declare
the variable assigned to the items in the SElection collection?

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

"Zuber" wrote in message
...
Hello,

I am working on an issue related with add-in for Outlook 2007. I need
some
help fixing it.

The issue is,

I have written some code to handle the OnSelectionChange() event. I am
calling a function from OnSelectionChange() which in turn invokes
GetSelectionItem() and works on that item.

The OnSelectionChange() event is fired twice or thrice when the
selection
changes. It works fine if I move between messages in the same folder,
but
when I select a different folder Outlook 2K7 crashes. The reason being;
when
folder selection changes the first event to get fired is for the
selected
message from the previous selected folder rather than for the new
selected
folder. The second event is for the folder.

The code expects the newly selected item to be a folder rather than a
message item, the code crashes due to this.

FYI, the same code works on Outlook 2003. I am not sure if anything
changed
for Outlook 2007, or something more is required from my end.

Thanks in advance for any solution.

Thanks and Regards,

Zuber






Ads