求CComPtr CComQIPtr的详细说明

hujun4u 2004-04-21 02:18:05
多次遇到 CComPtr CComQIPtr,
只知道它是深智能指针,,却不知其具体,,
请高人赐教,,,
...全文
137 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ygang76 2004-04-21
  • 打赏
  • 举报
回复
看看代码,然后调试一下不就清楚了啊
CComQIPtr比CComPtr高级一点,其能自动查询特定的接口
zhp80 2004-04-21
  • 打赏
  • 举报
回复
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

zhp80 2004-04-21
  • 打赏
  • 举报
回复
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

zhp80 2004-04-21
  • 打赏
  • 举报
回复
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
ColderRain 2004-04-21
  • 打赏
  • 举报
回复
你看看它是如何实现的(看VC里的源代码),就都清楚了。

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧