Active Template Library (ATL)

The Active Template Library (ATL) is a Microsoft C++ template library that simplifies the use of COM. It provides two smart pointer classes, CComPtr and CComQIPtr, that can be used to hold COM interface pointers and automatically call the IUnknown methods for interface navigation and reference counting. It also provides a class to encapsulate BSTRs and CComBSTR, which takes care of allocating and freeing the string; and a class to encapsulate VARIANTs, CComVariant, which does the same for VARIANTs.

For a basic explanation of ATL and how to use it, see http://msdn.microsoft.com/library/en-us/dnguion/html/msdn_093098.asp.