Introduction to ATL
ATL is the Active Template Library, a set of template-based C++ classes with which you can easily create small, fast Component Object Model (COM) objects. It has special support for key COM features including: stock implementations ofIUnknown,IClassFactory,IClassFactory2 andIDispatch; dual interfaces; standard COM enumerator interfaces; connection points; tear-off interfaces; and ActiveX controls.
ATL code can be used to create single-threaded objects, apartment-model objects, free-threaded model objects, or both free-threaded and apartment-model objects.
Topics covered in this section include:
How a template library differs from a standard C++ library.
What you can and cannot do with ATL.
When to use ATL versus MFC.
Introduction to COM
COM is the fundamental "object model" on which ActiveX Controls and OLE are built. COM allows an object to expose its functionality to other components and to host applications. It defines both how the object exposes itself and how this exposure works across processes and across networks. COM also defines the object's life cycle.
Fundamental to COM are these concepts:
Interfaces — the mechanism through which an object exposes its functionality.
IUnknown — the basic interface on which all others are based. It implements the reference counting and interface querying mechanisms running through COM.
Reference counting — the technique by which an object (or, strictly, an interface) decides when it is no longer being used and is therefore free to remove itself.
QueryInterface — the method used to query an object for a given interface.
Marshaling — the mechanism that enables objects to be used across thread, process, and network boundaries, allowing for location independence.
Aggregation — a way in which one object can make use of another.
See Also The Component Object Model in the Win32 SDK
Active Technology Topics
Home | Overview | How Do I
Active technologies (formerly called ActiveX) use the Component Object Model (COM) to enable software components to interact with one another in a networked environment, regardless of the language with which they were created. Active technologies can be used to create applications that run on the desktop or the Internet.
Active technologies include both client and server technologies, including the following:
Active document containment, supported in MFC versions 4.2 and later, allows users to view Active documents (such as Microsoft Excel or Word files) and activate the entire interface of the document's native application in the entire client area of an Active document container such as the Microsoft Office Binder or Microsoft Internet Explorer. The containers act as clients, while the documents are provided by Active document servers.
ActiveX controls are interactive objects that can be used in containers such as a Web site. For more information on ActiveX controls, see:
ActiveX Controls (Adding User Interface Features)
Internet First Steps: ActiveX Controls
Internet Support: Overview
Upgrade an Existing ActiveX Control to be Used on the Internet
Active Scripting controls the integrated behavior of one or more ActiveX controls and/or Java programs from a browser or server. For more information on Active Scripting, see:
Script an ActiveX Control on a Web Page
Active Technology on the Internet
Automation (formerly known as OLE Automation) makes it possible for one application to manipulate objects implemented in another application, or to “expose” objects so they can be manipulated.
The automated object might be local or remote (on another machine accessible across a network). Automation is available for both OLE and COM objects.
For a discussion of what is still called OLE versus what is now called Active technology, see OLE Topics.
What do you want to know more about?
Overview of Active Document Containment
Example of Active Document Containment: Office Binder
Creating an Active Document Container Application
Active Document Containers
Active Document Servers
Active Documents
Sample Programs
The MFCBIND sample illustrates the implementation of an Active document container application.
The BINDSCRB sample illustrates the use of Active interfaces to provide Active documents.
Adding OLE Support
Home | Overview | How Do I
The MFC library defines numerous classes for supporting OLE functionality, including classes that implement the standard OLE dialog boxes. AppWizard also provides support for the automated creation of OLE container and OLE server applications. See the OLE tutorials in Tutorials for information on using MFC and AppWizard to write OLE applications; the section Creating an OLE Server describes how to make the SCRIBBLE sample an OLE server. The section Creating an OLE Container describes how to write an OLE container, using the CONTAINER sample as an example.
The previous version of the DRAWCLI sample already had OLE container functionality implemented, so it was not necessary to add this feature to meet Windows 95 logo requirements. However, DRAWCLI previously did not have drag-and-drop support; the following section describes the addition of that functionality.
For other examples of OLE containers, see the CONTAINER and OCLIENT sample applications in the MFC samples. For examples of OLE servers, see the HIERSVR sample application and Step 7 of the SCRIBBLE tutorial sample in the MFC samples. MFC samples are found in Samples.