Classes and Structs
Classes and structs are the constructs used to define your own types. Classes and structs can both have data members and member functions that allow you to describe the type's state and behavior.
-
The struct is a user-defined data type that incorporates logically related data items of different data types such as float, char, int, and so on.
-
All struct elements are stored in contiguous memory locations. Structure type variables allow you to store multiple data items of varying data types under one name.
-
A class is a blueprint or instructions for creating a specific object type. It is a fundamental concept of Object-Oriented Programming that revolves around real-world entities.
-
In a programming language, a class determines how an object behaves and what it contains.
-
A class is a user-defined data type containing various data types and member functions.
Now that we have understood classes and structs let us quickly jump to understanding CDialoglmpl.
CDialogImpl Class
This class contains methods for generating modal or modeless dialog boxes. A dialog box is a common type of window in the GUI of an operating system (also spelled dialogue box and called a dialogue). In addition to providing more details, the dialogue box also requests input from the user.
For example: When you use a program and want to open a file, you interact with the "File Open" dialog box.

credit: cadence.com
Syntax
template <class T,
class TBase = CWindow>
class ATL_NO_VTABLE CDialogImpl : public CDialogImplBaseT<TBase>
Parameters
T = It is your class that is derived from CDialogImpl.
TBase = It is the base class of your new class. Although, the default base class is CWindow.
Now, there are two types of Dialog Boxes: Model and Modeless.
Modal and Modeless Dialog Box
A modal dialog prevents you from accessing the rest of the application until it is closed. When a modal dialogue box is open, it is always active and prevents opening any other dialogue boxes or windows until it is closed.
While the modeless dialogue is open, you can use the rest of the application. Other application windows may hide it.
So, as we discussed above, CDialogImpl class contains methods for generating both types of Dialog Boxes: Modal and Modeless.
Let us quickly jump to how it creates the Dialog box:

Methods
In the below-mentioned image, different methods are there for generating Dialog Boxes. We have briefly described each method in the image below to differentiate between the model and modeless dialog box.

Let us see the working of each method one by one:
CDialogImpl::Create
Create creates a modeless dialog box.

HWND Create(
HWND hWndParent,
LPARAM dwInitParam = NULL );
HWND Create(
HWND hWndParent,
RECT&,
LPARAM dwInitParam = NULL);
Parameters
hWndParent: It is the handle to the owner window.
RECT& rect: A RECT structure specifying the size and position of the Dialog.
dwInitParam: It specifies the value to be passed to the dialogue box in the WM INITDIALOG message's lParam parameter.
Return Value: It returns the handle to the newly created dialog box.
CDialogImpl::DestroyWindow
It destroys a modeless dialog box.

BOOL DestroyWindow();
Return Value: If the dialogue box was successfully destroyed, TRUE; otherwise, FALSE.
CDialogImpl::DoModel
DoModel creates a modal dialog box.

INT_PTR DoModal(
HWND hWndParent = ::GetActiveWindow(),
LPARAM dwInitParam = NULL);
Parameters
hWndParent: The handle to the owner window. The default value is the return value of the GetActiveWindow Win32 function.
dwInitParam: It specifies the value to pass to the dialog box in the lParam parameter of the WM_INITDIALOG message.
Return Value: If successful, the value of the nRetCode parameter specified in the EndDialog call is returned. Else, -1.
CDialogImpl::EndDialog
It destroys a modal dialog box.

BOOL EndDialog(int nRetCode);
Parameters
nRetCode: The value to be returned by CDialogImpl::DoModal.
Return Value: TRUE if the dialog box is destroyed; otherwise, FALSE.
Frequently Asked Questions
What does Active Template Library mean?
The Active Template Library is a collection of Microsoft C++ template classes (program routines) that are specially made to make it easier to code and develop for the Component Object Model (COM) and ActiveX.
What are C++ templates?
In C++, templates are an effective tool for passing data types as parameters to generalized functions.
What are some ATL applications?
The Active Template Library (ATL), a wrapper library that facilitates COM development, is frequently used to create ActiveX controls. Applications written in MFC or ATL can be made using Visual Studio Community Edition or higher.
What does Windows' COM object mean?
The Microsoft Component Object Model is a distributed, object-oriented method for creating binary software components that can communicate (COM).
Conclusion
Congratulations on finishing the blog! We have discussed the Windows support class-CDialogImpl in the active template library. Further, we have discussed various member functions in composite control classes.
This blog has helped to enhance your knowledge of the composite control classes in the active template library. Do not stop learning! We recommend you read some of our articles on the Active template library:
Check out our Data Structures and Algorithms-guided path to learn Data Structures and Algorithms. Also, check out some of the Guided Paths, Contests, and Interview Experiences to gain an edge only on Coding Ninjas Studio.
Cheers!