Introduction
In the late 1980s, Windows development was a really difficult task. Working in the Windows development environment meant only learning the Windows API. Everything in your Windows source code had to be accurate; otherwise, your program would not run. And above all, every Windows application was similar in one or the other way.
That’s why MFC came into existence. It saves developers from rewriting the message loops and window procedures. The catch is it was purely automatic. The developer does not have the choice to change or manipulate anything as per the situation’s requirements.
The ATL Window Classes is a reasonable mediator between adding MFC and coding straight from scratch.

This blog will teach various aspects of ATL Window Classes and several types of ATL Window Classes.
ATL Window Classes
ATL stands for Active Template Library. It is a library with numerous classes that permit you to use, manipulate and implement Windows. It provides an impressive implementation that would not cause overhead on your code.
ATL includes a set of template-based C++ classes that simplify the programming of Component Object Model (COM) objects. COM is a necessary specification used in creating and consuming software components on Windows. It is highly recommended when you want to use ATL Window Classes to their fullest extent. Some of the prominent COM features include dual interfaces, stock implementations, connection points, standard COM enumerator interfaces, ActiveX controls, and tear-off controls.
The diagram below shows the hierarchy of an ATL Window Class.

The table below describes several commonly used ATL Window Classes shown in the hierarchy.
ATL Class |
Description |
| CWindow | This class allows you to attach a window handle to the CWindow object. You can use CWindow methods to manipulate any window. |
| CWindowImpl | It implements a completely new window and processes messages using a message map. You can create a window based on an existing window class, and a superclass or subclass of an existing class. |
| CDialogImpl | This class permits you to implement a modeled or modeless dialog box and process messages using a message map. |
| CContainedWindowT | It is a prebuilt class used to implement a window whose message map is already present in another class. It permits you to centralize message processing in just one class. |
| CAxDialogImpl | This class permits you to implement a modeled or modeless dialog box that hosts ActiveX controls. |
| CSimpleDialog | This class implements a dialog box with a few basic functionalities. |
| CAxWindow | It allows you to implement a Window that hosts an ActiveX control. |
| CAxWindow2T | It allows the implementation of a Window that hosts a licensed ActiveX control. |
| CWndClassInfo | This class manages the information of a new Window Class. |
| CWinTraits | It provides a simple way for standardizing the traits of an ATL Window Object. |
| CWinTraitsOR | This class is the same as ‘CWinTraits’ class. However, it is compulsory to define some traits while using this class. |
We are done with learning the types of ATL Window Classes. Now, we will have a look at how to use a Window.
Using a Window
We use CWindow class to use any window. You have to attach that window to a CWindow object and call the CWindow methods to use and manipulate the Windows. You can easily merge CWindow method calls and Win32 function calls without creating or using any temporary objects.

There is an operator called ‘HWND operator’ in the CWindow class to convert a CWindow object into HWND. This way you can pass any CWindow object to desired function that needs a handle to a window. However, the HWND member is automatically passed to the corresponding Win32 function if using the CWindow class. Also, some other CWindow methods wrap the corresponding Win32 API functions along.
You already know that any ATL Window class does not cause an overhead on your code, and so does the CWindow class. This is because it has only two data members- a window handle and some default dimensions.
In addition, you can derive data or code from any class and add it to the CWindow class directly to use it anyway further. The ATL library derives three other ATL Window Classes from the CWindow class- CWindowImpl, CDialogImpl, and CContainedWindowT.





