The return value is meant to be used for diagnostic/testing purposes only! The value of nReference only is a "snapshot" of the moment :addRef() was called. When the method returns, another entity may have already changed the object's internal reference count and the return value may be obsolete. Therefore, making assumptions based on nReference is dangerous!
Method AutomationObject():addRef() Foundation
Increments the reference count.
:addRef() --> nReference
The new reference count.
The :addRef() method increments the internal reference count of the connected COM/ActiveX.
This method is called automatically during GetObject(), CreateObject(), :create() and :queryInterface(). Normally, applications need not call :addref() directly. See :interface for further information.
Each COM/ActiveX object knows inherently how often it has been referenced to. As long as its internal reference count has not reached zero, a COM/ActiveX object cannot be freed by its COM server. Thus, every call to :addRef() must have a corresponding call to :release().
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.