Inspector Wrapper Query

  • Thread starter Thread starter Kristy
  • Start date Start date
K

Kristy

Hi

I have written a com add-in for Outlook 2000 and XP in VB6 based on
the ItemsCB example. I am now at the point that I need to ensure that
all items are cleaned up properly especially since my add-in will be
run in 2000. I have read many posts on the Next/Previous issue but am
still a bit unclear as to what needs to be done to fix it so I am
hoping that someone can spell it out for me:-)

This is my understanding so far... Currently I am using the inspector
Close and Item_Close events to clean up but these events don't always
fire under every situation so I need to trap item_deactivate as well,
and possibly others? Because the Inspector deactivate event can also
fire when an Item isn't closing I need to compare the currentItem to
the items in the Inspectors collection, if it is part of the
collection still then I can assume that the item isn't closing and
just carry on otherwise I need to ensure that the item has been
completely removed from memory. To this end this is what I have so
far, but it doesn't work and I'm not sure what to do, or even if I'm
on the right track?

Private Sub m_objInsp_DeActivate()
Dim i As Integer
Dim objCurrentItem as Outlook.MailItem
Dim objInspWrap As InspWrap

For i = 1 To gcolInspWrap.Count

Set objCurrentItem = ActiveInspector.CurrentItem
Set objInspWrap = gcolInspWrap.item(i)

If Not objCurrentItem Is objInspWrap Then
MsgBox "yes, I'm still alive"
Else
MsgBox "no, better clean me up!"
End If

Next
End Sub

Where to from here. Please help.

Thanks

Kristy
 
Deactivate and Activate fire too often to be useful and fire in
different orders and frequencies depending on whether the item opened
using Next/Previous was ever opened in that Inspector and which button
is used.

I instantiate an item in the Inspector wrapper for each item type I
want to handle, declaring that item WithEvents. Then I can trap the
item closing and so on.
 
Back
Top