Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Hello, readers. In this article, we will learn about UtilityClass-CSize. It is one of the several classes provided by Active Template Library. We’ll briefly cover ATL, about CSize class, its syntax, and its members. We’ll also discuss why we use it.
Active Template Library
The Active Template Library (ATL) is a collection of template-based C++ classes that allow you to create small, quick COM(Component Object Model) objects. It supports major COM features such as standard COM enumerator interfaces, stock implementations, dual interfaces, tear-off interfaces, connection points, and ActiveX controls.
UtilityClass-CSize
This class is derived from the SIZE structure. As a result, you can send a CSize as a parameter when a SIZE is required, and the data members of the SIZE structure are also available for use with CSize. The SIZE structure defines the width and height of a rectangle. We use windef.h header file to use it.
The SIZE (and CSize) cx and cy members are open to the public. In order to modify the SIZE structure, CSize also implements member functions.
Syntax
#include<atltypes.h>
class CSize : public tagSIZE
Header file atltypes.h is required.
Members
Public Constructors
Name
Description
CSize::CSize
CSize object is built.
Public Operators
Name
Description
CSize::operator -
It subtracts two sizes.
CSize::operator !=
It will check for inequality between CSize and size.
CSize::operator +
It will add two sizes given.
CSize::operator +=
It will add a size to CSize.
CSize::operator -=
It reduces the size from the CSize.
CSize::operator ==
It will checks to see whether CSize and size are the same.
CSize::CSize
Constructs a CSize object.
CSize() throw();
CSize( int initCX, int initCY) throw();
CSize( SIZE initSize) throw();
CSize( POINT initPt) throw();
CSize( DWORD dwSize) throw();
Parameters
Name
Description
initCX
Sets the CSize's cx member.
initCY
CSize's cy member is set.
initCSize
Used to initialize CSize is the initSize SIZE structure or CSize object.
initPt
CSize is initialized using the initPt POINT structure or CPoint object.
dwSize
CSize was set up using the DWORD dwSize. The cx member is a low-order word, whereas the cy member is a high-order word.
Note: cx and cy are initialized to zero if no arguments are provided.
You can send a CSize as a parameter when a SIZE is required, and the data members of the SIZE structure are also available for use with CSize.
What is the use of the SIZE structure?
The SIZE structure defines the width and height of a rectangle. We use windef.h header file to use it.
What is ATL?
ATL stands for Active Template Library. It is a collection of template-based C++ classes that allow you to create small, quick COM(Component Object Model) objects.
Conclusion
In this article, we learned about UtilityClass-CSize. It is one of the several classes provided by Active Template Library.
If you want to explore more, here are some related articles -