Table of contents
1.
Introduction
2.
Introduction to COM
3.
CComModule Replacement Classes
3.1.
Reasons for Distributing CComModule Functionality
4.
Frequently Asked Questions
4.1.
What is an ATL application?
4.2.
What is ATL?
4.3.
What are ATL and MFC?
5.
Conclusion 
Last Updated: Mar 27, 2024

ATL module classes

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Let's ensure we understand the foundational concepts before delving further into the subjects. Here is a brief introduction if you are unfamiliar with the Active Template Library.

ATL module classes

Active Template Library (ATL), a collection of C++ classes built using templates, makes programming Component Object Model (COM) objects easier. For building and consuming software components on Windows, COM is a binary specification. It is strongly advised to be familiar with COM to better use ATL.

This article explains the details of ATL module classes, in which we will talk about CComModule Replacement Classes and Reasons for Distributing CComModule Functionality.

 

Without further ado, let's get started.

Introduction to COM

The "object model" upon which ActiveX Controls and OLE are based is COM. Using COM, a component can expose its capabilities to host apps and other components. It specifies how the object exposes itself and how this exposure operates across networks and processes. COM also defines the life cycle of an object.

📂 These ideas form the basis of COM:

🎯 Interfaces — the mechanism via which an item exposes its capabilities.

🎯 IUnknown — the basic interface on which all others are based. It puts into practise the reference counting and interface querying processes used by COM. 

🎯 Reference counting — the process by which an object (or, strictly speaking, an interface) determines when it is no longer required and may thus be removed from the system 

🎯 QueryInterface — the technique for searching an object for a specific interface

🎯 Marshaling — the method that allows for the location-independent use of objects across the thread, process, and network borders.

🎯 Aggregation — the use of one thing to benefit from another.
 

CComModule Replacement Classes

💁 ATL's earlier iterations made use of CComModule. The functionality of CComModule is replaced by a number of classes in ATL 7.0:

☑️ Most applications that use ATL will need the information found in CAtlBaseModule. Contains the resource instance's HINSTANCE as well as the module's HINSTANCE.  

☑️ The ATL COM classes' information is contained in the CAtlComModule.

☑️ Information needed by the ATL windowing classes is contained in the CAtlWinModule.

☑️ Support for interface debugging is provided by the CAtlDebugInterfacesModule.

☑️ CAtlModule The information needed in each of the following CAtlModule-derived classes is specific to that application type. The majority of these classes' members can be overridden:
 

✅ CAtlDllModuleT utilised in DLL software. code for the common exports is provided.

✅ CAtlExeModuleT used by EXE programmes. provides the code needed for an EXE.

✅ Create Windows NT and Windows 2000 Services with the help of the CAtlServiceModuleT.

Reasons for Distributing CComModule Functionality

📁 For the following reasons, CComModule's functionality was split up into a number of new classes:

✔️ Make CComModule's functionality more precise.

Application-specific (DLL or EXE) functionality, windowing, interface debugging, and COM support are now all in separate classes.

✔️ Declare a global instance of each of these modules automatically.

The relevant module classes are integrated into the project as a global instance.

✔️ Eliminate the need to invoke the Term and Init procedures.

There is no longer a requirement to call Init and Term because these methods have been relocated into the constructors and destructors for the module classes.


Also see, Application of Oops

Frequently Asked Questions

What is an ATL application?

Microsoft created a collection of template-based C++ classes called the Active Template Library (ATL) to make programming Component Object Model (COM) objects easier. Developers can create different COM objects, OLE Automation servers, and ActiveX controls thanks to the COM support in Microsoft Visual C++.

What is ATL?

Active Template Library (ATL), a collection of C++ classes built using templates, makes it easier to programme Component Object Model (COM) objects. For building and consuming software components on Windows, COM is a binary specification. It is strongly advised to be familiar with COM to better use ATL.

What are ATL and MFC?

A C++ object-oriented wrapper for Win32 is provided by the Microsoft Foundation Classes (MFC) to facilitate the quick building of native desktop programs. ActiveX controls are frequently created using the Active Template Library (ATL), a wrapper library that makes COM development easier.

Conclusion 

Congratulations on finishing the blog! We have discussed the details of  ATL module classes, in which we discuss CComModule Replacement Classes and Reasons for Distributing CComModule Functionality.

We hope this blog has helped you enhance your knowledge of  ATL module classes. If you'd like to learn more, Check out the following links:

🔥 Classes and Objects

🔥 Constructors and Destructors

🔥 Access specifier

 

Please refer to our guided pathways on Code studio to learn more about DSACompetitive ProgrammingJavaScriptSystem Design, etc. Enroll in our courses, and use the accessible sample exams and questions as a guide. For placement preparations, look at the interview experiences and interview package.

Please upvote 🏆 our blogs 🎈 if you find them helpful and informative!

Happy coding🤗

Live masterclass