While it is quite straightforward to create and manage COM component objects using the techniques outlined in the preceding sections, bugs can easily be introduced if the AddRef and Release rules are not strictly followed. To alleviate this problem you can create "smart pointer" classes for interfaces, and these smart pointers automatically call AddRef and Release at the appropriate times.
Smart pointers are created using the _COM_SMARTPTR_TYPEDEF macro that is declared in the header file comdef.h. The macro is passed the following:
The class name declaring the interface functions. For example, you may use IPOutlookApp, and this interface is declared in pimstore.h.
The result of using the __uuidof macro, which is passed the ...