Recently a user asked this question in forums, I was quite able to answer his query. So thought this might be useful to you guys too. 🙂
So the basic difference is that CComPtr is an ATL class is used with using ATL COM implementations while _com_ptr_t is one of the few COM support classes to support non ATL COM development. The definitions of these COM support classes go along with the tlb files and probably that’s why they are called as COM support classes. Also their definition can be found in comdef.h too. The other classes similar to _com_ptr_t are …
So what are COM support classes? These are special lightweight classes that wraps basic useful COM functionality so that ideas like COM smart pointer typedefs over raw COM inteface classes works just by using tlb file. An example on how _com_ptr_t is used…
[sourcecode language=”cpp”]_COM_SMARTPTR_TYPEDEF(IMyInterface, __uuidof(IMyInterface));[/sourcecode]
This above line declares _com_ptr_t specialization IMyInterfacePtr.
The library to link to for using COM support classes is comsuppw.lib.