View Single Post
  #10  
Old December 20th 07, 12:34 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook 2007 crash

I can only suggest that you rewrite your ECE as a COM add-in - installation
will be a lot easier, and I suspect that ECE saupport will be at least
limited in the next version of Outlook.

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

"Zuber" wrote in message
news
Hi Dmitry,

The workaround solution of using PostMessage() worked for me, but its
causing other problems. I have a customized context menu for messages
which
was working before this change but it has now stopped working. Outlook
fails
to bring up the customized context menu and instead shows the default
Outlook
context menu. Investigating further shows that the Message Handler for
WM_SHOWPOPUP never gets invoked.

Any thing in addition to PostMessage() needs to be done ? Any help for
this
is appreciated.

Thanks in advance.

Regards,
Zuber

"Zuber" wrote:

Hi Dimitry,

Your workaround solution of PostMessage() just seem to have worked for me
too.

Looks like GetSelectionItem() does not work if used from
OnSelectionChange()
for Outlook 2007.

I am doing some tests to check if it has really fixed the issue.

Thanks for all your help.

Thanks and Regards,

Zuber

"Dmitry Streblechenko" wrote:

Hmmm.. I stopped using ECE in Outlook 2007 (I still use them in the
previous
versions of Outlook), so I can't really verify what is going on.
Does this happen for any folder or just the Calendar folders?
I remember a similar issue in Outlook 97 where GetSelectionItem() will
choke
if called from OnSelectionChange.
I worked around that by posting 0xF449 command using

PostMessage(hwndExchange, WM_COMMAND, 0xF449, 0);

where hwndExchange comes from IEXCHEXTCALLBACK::GetWindow() and doing
the
processing in DoCommand().

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

"Zuber" wrote in message
...
The variables have been initialized as follows:

UpdateSelection(LPEXCHEXTCALLBACK lpeecb)
{
TCHAR szMsgClass[SOTC_MSGCLASS_SIZE];
ULONG dwMsgFlags = 0;
LPENTRYID pEID = NULL;
ULONG ulSelect = 0;
ULONG cbEID = 0;
ULONG ulType = 0;

CComPtrIExchExtCallback m_spExchCallback;
m_spExchCallback = lpeecb;
m_spExchCallback-GetSelectionCount(&ulSelect);

for( int i=0 ; i ulSelect ; i++ )
{
m_spExchCallback-GetSelectionItem ( i ,&cbEID, &pEID, &ulType,
szMsgClass,

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

"Dmitry Streblechenko" wrote:

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