How to get the current reference count of an objec

2019-07-20 13:54发布

问题:

I have a pointer to a COM object (in C++). Is there a way to get the current reference count of the object which the pointer is pointing to?

回答1:

Call IUnknown::AddRef and then immediately IUnknown::Release. The value returned by the latter is current count of outstanding references. Note that the value does not have to be accurate, it is informational only.



标签: c++ com