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

Outlook 2007 crash



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 29th 07, 07:49 AM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

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
  #2  
Old October 29th 07, 06:02 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook 2007 crash

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



  #3  
Old October 29th 07, 07:06 PM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

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




  #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






  #5  
Old October 30th 07, 07:51 AM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

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






  #6  
Old October 30th 07, 09:19 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Outlook 2007 crash

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








  #7  
Old October 31st 07, 07:50 AM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

This happens if you switch between any folders.

"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









  #8  
Old November 6th 07, 10:47 AM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

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









  #9  
Old December 19th 07, 12:31 PM posted to microsoft.public.outlook.program_addins
Zuber
external usenet poster
 
Posts: 6
Default Outlook 2007 crash

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









  #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











 




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
Crash during contact import - Outlook 2007 Zarborg Outlook - Using Contacts 7 September 24th 07 11:28 PM
Outlook 2007 CRASH ON DEMAND Not happy Outlook user Outlook - Installation 1 April 27th 07 10:33 PM
Outlook 2007 Crash on Demand Not happy Outlook user Outlook - Installation 1 April 27th 07 10:33 PM
Crash outlook 2007 Jan Outlook - Installation 2 September 9th 06 05:10 PM
Crash in GetMAPIOBJECT + Outlook 2007 pete_42 Add-ins for Outlook 16 June 19th 06 07:26 PM


All times are GMT +1. The time now is 07:03 AM.


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.