PC Review


Reply
Thread Tools Rate Thread

Accessing Count property calls Release()

 
 
Eric
Guest
Posts: n/a
 
      14th Oct 2003
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).
 
Reply With Quote
 
 
 
 
Eric
Guest
Posts: n/a
 
      14th Oct 2003
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).

 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting property value to string or accessing property methods Brian Mitchell Microsoft VB .NET 2 26th May 2005 01:27 PM
accessing the same DB with two calls in two usercontrols...good? bad? Darrel Microsoft ASP .NET 2 4th Nov 2004 05:20 PM
I am adding a new row to the datagrid dynamically but if i use the Count property of Item it is not showing the count of the new rows being added Praveen Balanagendra via .NET 247 Microsoft ASP .NET 2 6th Jun 2004 08:16 AM
Property Value Changes Value between calls =?Utf-8?B?cG9seW5vbWlhbDVk?= Microsoft ADO .NET 1 4th Feb 2004 08:11 AM
Accessing Application.Explorers.Count property calls Release() ?? Eric Microsoft Outlook Program Addins 1 14th Oct 2003 09:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:16 PM.