OnOLInspectorActivate timing issues

Add-in Express™ Support Service
That's what is more important than anything else

OnOLInspectorActivate timing issues
 
Cory Osborn




Posts: 3
Joined: 2005-05-17
It seems the timing of when the OnOLInspectorActivate event is fired and when OutlookApp.ActiveInspector is set are off. I would expect that when the event is fired, ActiveInspector would point to the newly activated window and not the one that was just activated, but this doesn't seem to be the case.

I am running ADX-VCL 2.2b219. The add-in is running on Outlook 2003 on my dev machine.

The scenario:

  • Start Outlook
  • Open a mail item (MI1)
  • During OnOLInspectorActivate, OutlookApp.ActiveInpector is nil
  • Go back to Outlook Explorer w/o closing the mail inspector and open a second mail item (MI2)
  • During OnOLInspectorActivate, OutlookApp.ActiveInspector points to MI1
  • Use ALT+TAB or other means to switch focus back to MI1
  • During OnOLInspectorActivate, OutlookApp.ActiveInspector points to MI2


I change the visibility of certain buttons on my Mail Inspector's custom command bar depending on the content of the email being viewed, so this is an important issue to me. Because of the bad timing with ActiveExplorer, the buttons being made visible are based on the window that just lost focus (and no, I'm not accidentally using OnOLInspectorDeactivate :) ).

I realize I'm not on the latest release of ADX, but is this something that would have been fixed in the 2.3 preview release?

Is there another way to reference the inspector that just received focus other than OutlookApp.ActiveInspector during the OnOLInspectorActivate?

I realize this could also be an issue with when Outlook is firing the event that you've hooked into via the Outlook Object Model and its Microsoft's fault its firing before ActiveInspector is updated - if so, just let me know - I like blaming stuff on Microsoft.

Posted 17 May, 2005 18:10:36 Top
Cory Osborn




Posts: 3
Joined: 2005-05-17
Reading through the adxAddin source and seeing where you call the OnInspectorActivate events - it seems this must be a Microsoft issue when the event is fired before assigning ActiveInspector.

I was also able to see that the sender passed to this event was a TInspector and I could use that to see which Inspector was being activated by looking at it as TInspector(Sender).DefaultInterface.

Maybe this will help somebody else who runs into the same problem.
Posted 17 May, 2005 20:08:43 Top
Roger Middlebrook




Posts: 98
Joined: 2004-08-24
I have come across this problem and it is actually slightly worse than so far described.

When Outlook triggers OnInspectorActivate events the inspector may not have finished dealing with its content. In my case I wanted to know exactly how a mail item looked after Outlook had opened it (to reply, forward etc) but before the user had typed anything. I found that I could not be certain that the reply headers had been inserted when the OnInspectorActivate was first triggered.

I then wrote some embarrassingly ugly code to deactivate the inspector immediately after the first OnInspectorActivate and then reactivate it. In the second OnInspectorActivate I found the mail item was always ready for analysis.
it may be unhelpful, but it's all I've got...
Posted 18 May, 2005 03:21:48 Top
Dmitry Kostochko


Add-in Express team


Posts: 2741
Joined: 2004-04-05
Hi Cory and Roger,

Cory Osborn:
Reading through the adxAddin source and seeing where you call the OnInspectorActivate events - it seems this must be a Microsoft issue when the event is fired before assigning ActiveInspector.


There are quite a lot of things from MS that are not clear enough but nothing can be done here and we have to put up with it. Unfortunately...

Cory Osborn:
I was also able to see that the sender passed to this event was a TInspector and I could use that to see which Inspector was being activated by looking at it as TInspector(Sender).DefaultInterface.

Maybe this will help somebody else who runs into the same problem.


You have choosen the right way, the Sender parameter is a TInspector and is always valid.

Roger Middlebrook:
I have come across this problem...


Roger, thank you for your message. I think your information is very helpful. Unfortunately, as I write above MS code is not always executed as we would like to.

Posted 18 May, 2005 07:04:48 Top