描述:
多次遇到 CComPtr CComQIPtr,
只知道它是深智能指针,,却不知其具体,,
请高人赐教,,,
解决方案1:
看看代码,然后调试一下不就清楚了啊
CComQIPtr比CComPtr高级一点,其能自动查询特定的接口
This class provides a basis for smart pointer classes using COM-based memory routines.
template <
class T
> class CComPtrBase
Parameters
T
The object type to be referenced by the smart pointer.
Remarks
This class provides the basis for other smart pointers which use COM memory management routines, such as CComQIPtr and CComPtr. The derived classes add their own constructors and operators, but rely on the methods provided by CComPtrBase.
Requirements
Header: atlcomcli.h
A smart pointer class for managing COM interface pointers.
template<
class T,
const IID* piid = &__uuidof(T)
>
class CComQIPtr: public CComPtr<T>
Parameters
T
A COM interface specifying the type of pointer to be stored.
piid
A pointer to the IID of T.
Remarks
ATL uses CComQIPtr and CComPtr to manage COM interface pointers, both of which derive from CComPtrBase. Both classes perform automatic reference counting through calls to AddRef and Release. Overloaded operators handle pointer operations.
For an example of using CComQIPtr and CComPtr, see the CComPtr class overview.
Requirements
Header: atlcomcli.h
A smart pointer class for managing COM interface pointers.
template<
class T
>
class CComPtr
Parameters
T
A COM interface specifying the type of pointer to be stored.
Remarks
ATL uses CComPtr and CComQIPtr to manage COM interface pointers. Both are derived from CComPtrBase, and both perform automatic reference counting.
Requirements
Header: atlcomcli.h
你看看它是如何实现的(看VC里的源代码),就都清楚了。