HOME

TheInfoList



OR:

The Active Template Library (ATL) is a set of template-based
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
classes developed by
Microsoft Microsoft Corporation is an American multinational technology corporation producing computer software, consumer electronics, personal computers, and related services headquartered at the Microsoft Redmond campus located in Redmond, Washin ...
, intended to simplify the programming of Component Object Model (COM) objects. The COM support in
Microsoft Visual C++ Microsoft Visual C++ (MSVC) is a compiler for the C, C++ and C++/CX programming languages by Microsoft. MSVC is proprietary software; it was originally a standalone product but later became a part of Visual Studio and made available in both tri ...
allows developers to create a variety of COM objects,
OLE Automation In Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation) is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for us ...
servers, and
ActiveX ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide We ...
controls. ATL includes an object wizard that sets up primary structure of the objects quickly with a minimum of hand coding. On the COM client side ATL provides
smart pointer In computer science, a smart pointer is an abstract data type that simulates a pointer while providing added features, such as automatic memory management or bounds checking. Such features are intended to reduce bugs caused by the misuse of poin ...
s that deal with COM reference counting. The library makes heavy use of the
curiously recurring template pattern The curiously recurring template pattern (CRTP) is an idiom, originally in C++, in which a class X derives from a class template instantiation using X itself as a template argument. More generally it is known as F-bound polymorphism, and it is a ...
.


History

COM objects can also be created with
Microsoft Foundation Classes Microsoft Foundation Class Library (MFC) is a C++ object-oriented library for developing desktop applications for Windows. MFC was introduced by Microsoft in 1992 and quickly gained widespread use. While Microsoft has introduced alternative app ...
(MFC), but this leads to larger binaries that require support DLLs. ATL, on the other hand, is a more lightweight alternative in situations where the graphical user interface parts of MFC are not required. In ATL version 7 (Visual Studio 2003), which directly succeeded version 3 (Visual Studio 6.0), a number of MFC classes like CString were made available in ATL, or more precisely moved to an ATLMFC common layer which is shared by both libraries. ATL version 7 also introduced attributes in C++ in an attempt to provide something similar to CLI attributes, however these have not been particularly successful, and have been deemphasized in ATL version 8 (Visual Studio 2005); the various wizards no longer generate them by default. Version 7 also introduced new string conversion classes. On July 28, 2009, Microsoft released a patch to ATL to fix a bug that could allow
ActiveX ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide We ...
controls created using ATL to be vulnerable to a remote code execution security flaw. Since Visual Studio 2013, ATL code in Visual C++ 2013 is static, eliminating the DLL.


Support classes

ATL includes many RAII classes to simplify management of COM types. The most commonly used classes include: * CComPtr general-purpose smart-pointer, * CComBSTR BSTR wrapper, * CComVariant VARIANT wrapper, and * CComSafeArray SAFEARRAY wrapper.


Compiler COM support

Although not formally part of ATL, Microsoft Visual C++ also includes additional C++ RAII classes to simplify management of COM types. These ''compiler COM support'' classes can be used as replacement for or in combination with ATL, and includes: * _com_ptr_t smart-pointer that decorates the COM interface name with a "Ptr" suffix, * _bstr_t BSTR wrapper, * _variant_t VARIANT wrapper, and * _com_errorMicrosoft MSDN
_com_error Class
/ref> HRESULT wrapper. Note that as of Visual Studio 2012, the compiler COM support classes does not include a SAFEARRAY wrapper.


See also

*
ATL Server ATL Server is a technology originally developed by Microsoft for developing web-based applications. It uses a tag replacement engine written in C++ to render web pages. It draws on the existing technologies like ISAPI and the Active Template Li ...
* C++/CX *
OLE Automation In Microsoft Windows applications programming, OLE Automation (later renamed to simply Automation) is an inter-process communication mechanism created by Microsoft. It is based on a subset of Component Object Model (COM) that was intended for us ...
*
Standard Template Library The Standard Template Library (STL) is a software library originally designed by Alexander Stepanov for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components called ''algorithms'', '' ...
* Windows Template Library *
Microsoft Windows SDK Microsoft Windows SDK, and its predecessors Platform SDK, and .NET Framework SDK, are software development kits (SDKs) from Microsoft that contain documentation, header files, libraries, samples and tools required to develop applications for Micr ...
* List of C++ template libraries


References


External links


Official MSDN reference documentation
{{Authority control C++ libraries Template Library