I just want know what exact difference between ComPtr
and CComPtr
, and whether ComPtr::As()
is analogue of CComPtr::QueryInterface()
?
I read documentation of both, but there is no clear answer to the question...
what exact difference between ComPtr and CComPtr
They are simply COM interface smart wrappers from different frameworks. ComPtr
is part of the Windows Runtime C++ Template Library (WRL). CComPtr
is part of the Active Template Library (ATL) . They serve similar purposes for their respective frameworks - to provide automated reference counting and refcount-safe typecasting. But you should not mix them interchangeably. If you are writing WRL code, use ComPtr
. If you are writing ATL code, use CComPtr
.
whether ComPtr::As() is analogue of CComPtr::QueryInterface()?
Yes, because As()
simply calls QueryInterface()
internally.