Active Template Library

Last updated
Active Template Library
Developer(s) Microsoft
Written in C++
Operating system Microsoft Windows
Type Library or framework
License Proprietary

The Active Template Library (ATL) is a set of template-based C++ classes developed by Microsoft, intended to simplify the programming of Component Object Model (COM) objects. The COM support in Microsoft Visual C++ allows developers to create a variety of COM objects, OLE Automation servers, and ActiveX controls. [1] [2] 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 pointers that deal with COM reference counting. The library makes heavy use of the curiously recurring template pattern.

Contents

History

COM objects can also be created with Microsoft Foundation Classes (MFC), but this leads to larger binaries that require support DLLs. [3] ATL, on the other hand, is a more lightweight alternative in situations where the graphical user interface parts of MFC are not required. [4]

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 controls created using ATL to be vulnerable to a remote code execution security flaw. [5]

Since Visual Studio 2013, ATL code in Visual C++ 2013 is static, eliminating the DLL. [6]

Support classes

ATL includes many RAII classes to simplify management of COM types. The most commonly used classes include:

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:

Note that as of Visual Studio 2012, the compiler COM support classes does not include a SAFEARRAY wrapper.

See also

Related Research Articles

Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language Visual Basic 6.0 built into most desktop Microsoft Office applications. Although based on pre-.NET Visual Basic, which is no longer supported or updated by Microsoft, the VBA implementation in Office continues to be updated to support new Office features. VBA is used for professional and end-user development due to its perceived ease-of-use, Office's vast installed userbase, and extensive legacy in business.

In computing, DLL Hell is a term for the complications that arise when one works with dynamic-link libraries (DLLs) used with Microsoft Windows operating systems, particularly legacy 16-bit editions, which all run in a single memory space.

<span class="mw-page-title-main">Windows API</span> Microsofts core set of application programming interfaces on Windows

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations that are often referred to by their own names. Almost all Windows programs interact with the Windows API. On the Windows NT line of operating systems, a small number use the Native API.

<span class="mw-page-title-main">Microsoft Visual C++</span> Integrated development environment product by Microsoft

Microsoft Visual C++ (MSVC) is a compiler for the C, C++, C++/CLI 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 trialware and freeware forms. It features tools for developing and debugging C++ code, especially code written for the Windows API, DirectX and .NET.

<span class="mw-page-title-main">Microsoft Foundation Class Library</span> Windows OS object-oriented library

Microsoft Foundation Class Library (MFC) is a C++ object-oriented library for developing desktop applications for Windows.

<span class="mw-page-title-main">Microsoft Visual Studio Express</span> Integrated development environment

Microsoft Visual Studio Express is a set of integrated development environments (IDEs) that Microsoft developed and released free of charge. They are function-limited version of the non-free Visual Studio and require mandatory registration. Express editions started with Visual Studio 2005.

Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses DirectX and attempts to provide a consistent programming model for building applications. It separates the user interface from business logic, and resembles similar XML-oriented object models, such as those implemented in XUL and SVG.

Windows Template Library (WTL) is a free software, object-oriented C++ template library for Win32 development. WTL was created by Microsoft employee Nenad Stefanovic for internal use and later released as an unsupported add-on to Visual Studio and the Win32 Framework SDK. It was developed primarily as a light-weight alternative to the Microsoft Foundation Classes and builds upon Microsoft's ATL, another lightweight API widely used to create COM and ActiveX libraries.

C++/CLI is a variant of the C++ programming language, modified for Common Language Infrastructure. It has been part of Visual Studio 2005 and later, and provides interoperability with other .NET languages such as C#. Microsoft created C++/CLI to supersede Managed Extensions for C++. In December 2005, Ecma International published C++/CLI specifications as the ECMA-372 standard.

C++ Technical Report 1 (TR1) is the common name for ISO/IEC TR 19768, C++ Library Extensions, which is a document that proposed additions to the C++ standard library for the C++03 language standard. The additions include regular expressions, smart pointers, hash tables, and random number generators. TR1 was not a standard itself, but rather a draft document. However, most of its proposals became part of the later official standard, C++11. Before C++11 was standardized, vendors used this document as a guide to create extensions. The report's goal was "to build more widespread existing practice for an expanded C++ standard library".

In the C++ programming language, auto_ptr is an obsolete smart pointer class template that was available in previous versions of the C++ standard library, which provides some basic RAII features for C++ raw pointers. It has been replaced by the unique_ptr class.

In the C++ programming language, new and delete are a pair of language constructs that perform dynamic memory allocation, object construction and object destruction.

Platform Invocation Services, commonly referred to as P/Invoke, is a feature of Common Language Infrastructure implementations, like Microsoft's Common Language Runtime, that enables managed code to call native code.

In Microsoft Windows applications programming, OLE 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 use by scripting languages – originally Visual Basic – but now is used by several languages on Windows. All automation objects are required to implement the IDispatch interface. It provides an infrastructure whereby applications called automation controllers can access and manipulate shared automation objects that are exported by other applications. It supersedes Dynamic Data Exchange (DDE), an older mechanism for applications to control one another. As with DDE, in OLE Automation the automation controller is the "client" and the application exporting the automation objects is the "server".

The Microsoft Windows operating system supports a form of shared libraries known as "dynamic-link libraries", which are code libraries that can be used by multiple processes while only one copy is loaded into memory. This article provides an overview of the core libraries that are included with every modern Windows installation, on top of which most Windows applications are built.

<span class="mw-page-title-main">Visual Basic (classic)</span> Event-driven programming language

The original Visual Basic is a third-generation event-driven programming language from Microsoft known for its Component Object Model (COM) programming model first released in 1991 and declared legacy during 2008. Microsoft intended Visual Basic to be relatively easy to learn and use. Visual Basic was derived from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects.

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 Library, and includes a template library which is dedicated for use with developing Web-based applications.

<span class="mw-page-title-main">Visual Studio</span> Code editor and IDE

Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

ActiveX Document is a Microsoft technology that allows users to view and edit Microsoft Word, Excel, and PDF documents inside web browsers. It defines a set of Component Object Model coding contracts between hosting programs like Internet Explorer or Microsoft Office Binder and hosted documents from programs like Microsoft Word, Microsoft Excel and Adobe Reader. This allows them to negotiate communications about commands like save and navigate, as well as merging user interface elements such as menu, to provide a unified user experience.

Component Object Model (COM) is a binary-interface standard for software components introduced by Microsoft in 1993. It is used to enable inter-process communication object creation in a large range of programming languages. COM is the basis for several other Microsoft technologies and frameworks, including OLE, OLE Automation, Browser Helper Object, ActiveX, COM+, DCOM, the Windows shell, DirectX, UMDF and Windows Runtime. The essence of COM is a language-neutral way of implementing objects that can be used in environments different from the one in which they were created, even across machine boundaries. For well-authored components, COM allows reuse of objects with no knowledge of their internal implementation, as it forces component implementers to provide well-defined interfaces that are separated from the implementation. The different allocation semantics of languages are accommodated by making objects responsible for their own creation and destruction through reference-counting. Type conversion casting between different interfaces of an object is achieved through the QueryInterface method. The preferred method of "inheritance" within COM is the creation of sub-objects to which method "calls" are delegated.

References

  1. Grimes, Richard (1998). "ATL and COM". ATL COM (1st ed.). Wrox Press. p.  6. ISBN   1-86100-249-1.
  2. Grimes, Richard (1999). "Building and calling a COM object using ATL". Beginning ATL 3 COM Programming (1st ed.). Wrox Press. p.  63. ISBN   978-1-86100-120-7.
  3. Williams, Mickey (2000). "Active Documents". Visual C++ 6 Unleashed (1st ed.). Sams. p. 733. ISBN   978-0-672-31241-0.
  4. Microsoft MSDN: Recommendations for Choosing Between ATL and MFC
  5. "ATL Security Update". MSDN. Microsoft. 2009-07-28. Retrieved 2011-09-19.
  6. ATL and MFC changes and fixes in Visual Studio 2013 http://blogs.msdn.com/b/vcblog/archive/2013/08/20/atl-and-mfc-changes-and-fixes-in-visual-studio-2013.aspx
  7. Microsoft MSDN: CComPtr Class
  8. Microsoft MSDN: CComBSTR Class
  9. Microsoft MSDN: CComVariant Class
  10. Microsoft MSDN: CComSafeArray Class
  11. Microsoft MSDN: _com_ptr_t Class
  12. Microsoft MSDN: _bstr_t Class
  13. Microsoft MSDN: _variant_t Class
  14. Microsoft MSDN: _com_error Class