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

Help! Inspector.Close is fired before Inspector.Activate handler finishes



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 3rd 06, 10:51 AM posted to microsoft.public.outlook.program_addins
Sergey Anchipolevsky
external usenet poster
 
Posts: 6
Default Help! Inspector.Close is fired before Inspector.Activate handler finishes

Hello all.

I've been developing a C# Addin for OL2002/2003 and encountered a strange
problem.

Sometimes inspector's Close event is fired before the Activate handler finishes.
This can be reproduced by opening many inspectors and then closing them sequentially
as fast as possible. Logs show that Close handler is invoked before the Activate
handler finishes. Both handlers are executed in the same thread. As you can
imagine, this causes numerous problems, since the Close handler frees resources
allocated on Inspector creation.

First I thought that the reason might be an invokation of the message loop
(by calling Application.DoEvents() for example) hidden somewhere inside Activate
handler or its callees. But a thorough code analysis showed this is not the
case (at least in the addin). However the Activate handler makes many calls
to the Outlook object model.

I've made some protection from this situation: I don't free any resources
(that is normally done on Close) until Activate handler finishes. But it
looks like Outlook sometimes releases its internal objects before Close event
is fired, so Activate event handler cannot continue - any access to Outlook
object model causes either a null reference exception or a "COM wrapper"
exception.

Does anybody know the real cause of that? Does my addin do something wrong,
or is it an Outlook's "feature"?

The only workaround that comes in mind is creating proxies for Outlook objects
to use them in Activate event handler (as well as in all other handlers).
These proxies would check if the inspector is "closed" before any real operations.
But this decision is quite costly.

Is there a simpler solution?

Any help would be really appreciated.

Thanks in advance.

WBR,
Sergey Anchipolevsky


 




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
Outlook 2003 fires an Inspector Close when a send is cancelled Steve D Add-ins for Outlook 8 February 8th 06 11:22 PM
how do activate spellckeck in OE FerrisJ Outlook - Installation 2 February 7th 06 02:49 PM
How to find out which is the current item shown in the inspector? Michael Reukauff Add-ins for Outlook 1 January 25th 06 02:33 PM
how to add commandbarbutton to inspector window Ram Outlook - General Queries 1 January 18th 06 08:42 PM
how to add commandbarbutton to inspector window Ram Add-ins for Outlook 0 January 18th 06 03:18 PM


All times are GMT +1. The time now is 05:22 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.