PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Inspector Wrapper Query

Reply

Inspector Wrapper Query

 
Thread Tools Rate Thread
Old 05-12-2003, 03:37 AM   #1
Kristy
Guest
 
Posts: n/a
Default Inspector Wrapper Query


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
  Reply With Quote
Old 05-12-2003, 05:51 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Inspector Wrapper Query

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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginners Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Kristy" <kristy@fluidsoftware.co.nz> wrote in message
news:1c6477a7.0312041937.603ed17c@posting.google.com...
> 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



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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