To Active Template Library: Shreya Dhoke

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

INTRODUCTION

TO ACTIVE
TEMPLATE
LIBRARY
~Shreya Dhoke
Dept Of :MSc. Computer science and Electronics
CONTENT:

 Introduction
 Definition
 Classes
 ATL and COM
 Fundamental of ATL COM objects
INTRODUCTION :
 ATL is designed to simplify the process of creating efficient,
flexible, lightweight controls.

 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.

 ATL includes an object wizard that sets up primary structure of the


objects quickly with a minimum of hand coding.
WHAT IS ATL(ACTIVE
TEMPLATE LIBRARY )?
 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 of IUnknown, IClassFactory, IClassFactory2, and IDispatch;
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.
Active Template Library

Developer(s) Microsoft

Written in C++

Operating system Microsoft Windows

Type Library or framework

License Proprietary
CLASSES IN ATL:
ATL includes many classes to simplify management of COM types.
The most commonly used classes include:
 CComPtr<T> general-purpose smart-pointer
 CComBSTR BSTR wrapper
 CComVariant VARIANT wrapper
 CComSafeArray<T> SAFEARRAY wrapper.
Class / struct Description Header file
Contains information used for
rendering to various targets, such
ATL_DRAWINFO atlctl.h
as a printer, metafile, or ActiveX
control.

Contains class instance data in


_AtlCreateWndData atlbase.h
windowing code in ATL.

_ATL_BASE_MODULE70 Used by any project that uses ATL. atlbase.h

Used by COM-related code in


_ATL_COM_MODULE70 atlbase.h
ATL.
Contains type information used to
_ATL_FUNC_INFO describe a method or property on a atlcom.h
dispinterface.
Contains data used by every ATL
_ATL_MODULE70 atlbase.h
module.
_ATL_WIN_MODULE70 Used by windowing code in ATL. atlbase.h
CA2AEX
ATL CLASSES AND STRUCTS
Class / struct Description Header file
This class is a wrapper for an access
CAccessToken atlsecurity.h
token.

CAtlArray This class implements an array object. atlcoll.h

This class implements a thread-


CAtlAutoThreadModule pooled, apartment-model COM atlbase.h
server.

This class provides methods for


CAtlAutoThreadModuleT implementing a thread-pooled, atlbase.h
apartment-model COM server.

This class is instantiated in every ATL


CAtlBaseModule atlcore.h
project.
This class implements a COM server
CAtlComModule atlbase.h
module.
This class provides support for
CAtlDebugInterfacesModule atlbase.h
debugging interfaces.
ATL SUPPORT FOR COM
SERVERS :
COM Servers provide following services
 Register and unregister all classes in the server and its type library.
 Provide the Service Control Manager (SCM) access to class
factories hosted by servers
 Manager life servers.
FUNDAMENTALS OF ATL AND
COM:
 There are three ways to define an ATL COM object.
 The standard option is to use the CComObject class which is
derived from CYourClass.
 The second option is to create an aggregated object by using
the CComAggObject class.
 The third option is use to
the CComPolyObject class. CComPolyObject acts as a hybrid: it
can function as a CComObject class or as
a CComAggObject class, depending on how it is first created.
 Other aspects of your ATL COM object are handled by other
classes:
 CComCoClass defines the object's default class factory and
aggregation model.
 IDispatchImpl provides a default implementation of
the IDispatch Interface portion of any dual interfaces on the
object.
 ISupportErrorInfoImpl implements
the ISupportErrorInfo interface that ensures error information
can be propagated up the call chain correctly.
 The template classes CComObject, CComAggObject,
and CComPolyObject are always the most derived
classes in the inheritance chain.
 It is their responsibility to handle all of the methods
in IUnknown: QueryInterface, AddRef, and Release.
 CComAggObject and CComPolyObject (when used for
aggregated objects) provide the special reference
counting and QueryInterface semantics required for
the inner unknown.
Thank you.

You might also like