Introduction
Welcome Ninjas. How is the learning going? Have you heard of the Active Template Library? Are you curious to learn about it? Are you confused about the resources? Well, you are at the right place. In this blog, we will begin with the introduction of the Active Template Library and then look into the ATL Control Containment. Let us get started!
The active Template library is developed by Microsoft, and it comprises template-based C++ classes. ATL simplifies the programming of COM - The component Object Model. It can create dialog boxes, Internet explorer controls, etc. ATL makes programming Component Object Model (COM) objects easier. COM, being a binary specification, can be used to build and consume software components on Windows.
ATL Control Containment
Now that we know what ATL is, and how it functions, let us start with our blog's primary topic- ATL Control Containment.
In ATL, the control-creation process specifies the core of how the ATL hosts control. The implementation of the required container interfaces by ATL is called CAxHostWindow.
A CAxHostWindow has formed with two things:
- a window (CWindowImpl)
- a COM implementation (CComObjectRootEx)
When the container wants to host a control, an instance of CAxHostWindow is created, but not directly. Instead, an instance of a window class defined by ATL, called AtlAxWin80, is created.
This window is the parent window for the control and is subclassed by the instance of CAxHostWindow. We need to register the window class before an instance of its class is created. The function, AtlAxWinInit can be used to register the AtlAxWin80 window class.