本文介绍了如何获取对象的当前引用计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个指向COM对象的指针(在C ++中).有没有一种方法可以获取指针指向的对象的当前引用计数?

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?

推荐答案

调用 IUnknown :: AddRef ,然后立即 IUnknown :: Release .后者返回的值是未完成引用的当前计数.请注意,该值不一定是准确的,仅是参考信息.

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.

这篇关于如何获取对象的当前引用计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 14:49