I figured it out myself, just a bone-head move. I wasn't clearing the
VARIANT type variable before using it again, so somewhere inside the
OLE or Outlook code it must have been clearing it for me, which
explains the Release() call on the object.
(E-Mail Removed) (Eric) wrote in message news:<(E-Mail Removed)>...
> I'm using C++ to develop an Outlook COM Add-in. It appears that
> anytime I access a "Count" property I need to call AddRef() before
> doing so? Is this correct? It seems that accessing *ANY* "Count"
> property must internally call Release() on the object. I've seen this
> same behavior on the Application.Explorers object, and now on the
> Application.Explorers.Selection object. If I don't call AddRef()
> before I check the Count property, the object is release prematurely
> (I'm pretty sure) and I get access violations when closing Outlook.
>
> --------
> Sorry if this is kind of a repost, but I just posted another similar
> message and wanted to add to my previous comment (and reply isn't
> available yet because it hasn't posted yet).