Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
ATL stands for Active Template Library, developed by Microsoft. The purpose of ATL is to simplify the program based on the Component Object Model (COM ). An ATL contains a set of C++ template classes to develop efficient COM objects.
In this blog, we will discuss the ATL controls: General Class support and various classes and methods available in ATL control to manipulate the COM. But before that, let's talk about COM.
Component Object Model
COM is an object-oriented system that creates software components at a binary level to interact with different applications. It is a distributed and platform-independent system that is a foundation for technologies like Microsoft OLEs, Activex, and others.
You should remember that COM is not an object-oriented language, nor is it structured as an application and programming language. COM is a standard to specify the object models and requirements to enable the COM objects to interact with other entities.
COM is known as binary-specific components because the standard of COM is applied after the program is compiled into the machine code. In addition to defining the fundamental binary object standard, COM specifies a few virtual interfaces that offer features shared by all COM-based technologies and a select few functions that each component needs. In addition to defining how objects interact in a distributed environment, COM also includes security features that support system and component integrity.
There is a language requirement to implement the COM. A programming language must have the ability to create the structure of pointers either explicitly or implicitly and call functions with pointers.
Controls in ATL
In this section, we will discuss the general support classes in ATL, also known as the controls. Controls are available in various classes, but we will discuss the general support classes, mainly to know about the multiple classes and methods available to create COM.
CComControl Class
This class is responsible for creating and maintaining the ATL controls. CComControl class is considered a useful control helper function and a necessary data member for ATL controls.
To create a standard control, you need CComControl class because the ATL control wizard will derive our class from CComControl.
Syntax
template <class T, class WinBase = CWindowImpl<T>>
class ATL_NO_VTABLE CComControl: public CComControlBase,
public WinBase;
You can also try this code with Online C++ Compiler
Notifies about the changed property to sink containers.
CComControl::FireOnRequestEdit
Notifies about an upcoming change in property to sink containers.
CComControl::MessageBox
To generate or display the message box.
IOleControlImpl Class
This class provides a default implementation of the interface known as IOleControl. It implements the IUnknown interface by sending the data or information to the inactive or dump device present in debug build.
Syntax
template<class T>
class IOleControlImpl
You can also try this code with Online C++ Compiler
To perform fast initialization of the loaded controls.
IQuickActiveImpl::SetContenExtent
Shows information about the given display space of a container to control.
IPointerInactiveImpl Class
This class is responsible for manipulating the inactive objects in the program. An inactive refers to one that is running or loaded and cannot receive messages from the keyboard and mouse.
A small amount of mouse interaction can be supported by an inactive object, thanks to the IPointerInactive interface. For controls, this functionality is beneficial.
Syntax
template<class T>
class IPointerInactiveImpl
You can also try this code with Online C++ Compiler
Change the state of control from running to loaded.
IOleObjectImpl::DoVerb
Instructs the control to carry out one of its listed functions.
IOleObjectImpl::DoVerbDiscardUndo
Instructs the control to remove any undo state it may be holding.
IOleObjectImpl::DoVerbHide
Instructs the control to hide its user interface.
IOleObjectImpl::DoVerbInPlaceActivate
Install the control's window and starts the control, but do not install the user interface.
IOleObjectImpl::DoVerbOpen
Opens an editable version of the control in a different window.
IOleObjectImpl::DoVerbPrimary
Whenever a user double-clicks a control, the desired action is carried out.
IOleObjectImpl::DoVerbShow
Displays a recently added control to the user.
IOleObjectImpl::DoVerbUIactivate
Shows the control's user interface, including menus and toolbars, and activates the control in place.
Frequently Asked Questions
What does ATL stand for?
ATL stands for the active template library.
Why do we need ATL?
We need ATL to provide efficient and easy-to-implement COM objects.
What is the complete form of COM?
COM stands for the Component Object Model.
Does COM structure the applications?
No COM provides standards to manipulate the COM objects.
COM works at what level?
COM standards implemented for the binary level.
Conclusion
This blog discusses the Active Template Library ATL and Component Object Model COM. We have also discussed the ATL Controls: General Support classes and various public methods available in ATL.
To learn more about ATL, check out the following articles.