0% found this document useful (0 votes)
54 views

ATL ActiveX Control

The document discusses ActiveX controls and the Active Template Library (ATL). It provides 3 key points: 1) ATL simplifies programming COM objects like ActiveX controls through classes that handle reference counting and COM types. It includes wizards to quickly set up object structures. 2) ActiveX controls are reusable software components based on COM that support OLE functionality. They can be customized and used on the web or in containers. 3) Creating an ActiveX control with ATL is straightforward but less convenient than with MFC since ATL lacks features like device contexts. However, ATL provides more flexibility with things like dual interfaces.

Uploaded by

Deepshikha Mehta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

ATL ActiveX Control

The document discusses ActiveX controls and the Active Template Library (ATL). It provides 3 key points: 1) ATL simplifies programming COM objects like ActiveX controls through classes that handle reference counting and COM types. It includes wizards to quickly set up object structures. 2) ActiveX controls are reusable software components based on COM that support OLE functionality. They can be customized and used on the web or in containers. 3) Creating an ActiveX control with ATL is straightforward but less convenient than with MFC since ATL lacks features like device contexts. However, ATL provides more flexibility with things like dual interfaces.

Uploaded by

Deepshikha Mehta
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

DEPARTMENT OF ELECTRONICS & COMPUTER

SCIENCE RTMNU CAMPUS NAGPUR

ANURAG VIJAY MANDEWAR

SUBJECT : WINDOWS PROGRAMMING USING VISUAL


C++
TOPIC : ATL and ActiveX Controls
 Active Template Library (ATL)

•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.
•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.
Support classes :

ATL includes many RAII 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, and
•CComSafeArray<T> SAFEARRAY wrapper.
ActiveX controls
•An ActiveX control is a reusable software component based on the
Component Object Model (COM) that supports a wide variety of OLE
functionality and can be customized to fit many software needs.
•ActiveX controls are designed for use both in ordinary ActiveX control
containers and on the Internet, in World Wide Web pages.
•You can create ActiveX controls either with MFC, or with the 
Active Template Library (ATL).
•You can create windowless ActiveX controls and controls that only create a
window when they become active.
•Windowless controls speed up the display of your application and
make it possible to have transparent and nonrectangular controls.
•You can also load ActiveX control properties asynchronously.
•An ActiveX control is implemented as an in-process server
(typically a small object) that can be used in any OLE container.
•The full functionality of an ActiveX control is available only when
used within an OLE container designed to be aware of ActiveX
controls.
•This container type, hereafter called a "control container,"
can operate an ActiveX control by using the control's
properties and methods, and receives notifications from the
ActiveX control in the form of events.
•The following figure demonstrates this interaction.

Interaction Between an ActiveX Control Container and a Windowed ActiveX Control


Using ATL to Write a Control
•Although creating an ActiveX control using ATL is actually a pretty
straightforward process, using ATL ends up being a bit more burdensome than
using MFC.
•That's because ATL doesn't include all of MFC's amenities. For example, ATL
doesn't include device context wrappers.
•When you draw on a device context, you need to use the raw device context
handle. In addition, ClassWizard doesn't understand ATL-based source code, so
when you want your control to handle messages, you end up using the
"TypingWizard".
•That is, you end up typing the message maps in by hand. Despite these
issues, creating an ActiveX control using ATL is a whole lot easier than
creating one from scratch.
•Also, using ATL gives you a certain amount of flexibility you don't get when
you use MFC.
•For example, while adding dual interfaces to your control is a tedious
process with MFC, you get them for free when you use ATL.
•The ATL COM Object Wizard also makes adding more COM classes (even
non-control classes) to your project very easy, while adding new controls to
an MFC-based DLL is a bit more difficult.
Steps to create ActiveX control using ATL
By following the steps mentioned below we can create an ActiveX
control with the Ctrl class after Preparing the Program. The
ActiveX control you will obtain once this step is completed has a
minimal interface.
•Create a new project.
•Add a new ATL object.
•Add files to the project.
•Add the initialization and destruction of the display in the DllMain
function.
•Add a private member variable for CDemoATLCtrl.
•Add a new windows message handler to the CDemoATLCtrl
class.
•Modify the DemoATLCtrl.h file generated by the wizard.
•Modify the DemoATL.rc file.
•Modify the project settings.
•Build the ActiveX control.

You might also like