![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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 |
#2
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Crash during contact import - Outlook 2007 | Zarborg | Outlook - Using Contacts | 7 | September 24th 07 10:28 PM |
Outlook 2007 CRASH ON DEMAND | Not happy Outlook user | Outlook - Installation | 1 | April 27th 07 09:33 PM |
Outlook 2007 Crash on Demand | Not happy Outlook user | Outlook - Installation | 1 | April 27th 07 09:33 PM |
Crash outlook 2007 | Jan | Outlook - Installation | 2 | September 9th 06 04:10 PM |
Crash in GetMAPIOBJECT + Outlook 2007 | pete_42 | Add-ins for Outlook | 16 | June 19th 06 06:26 PM |