Simple Data Type Classes
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Simple Data Type Classes

The following classes encapsulate drawing coordinates, character strings, and time and date information, allowing convenient use of C++ syntax. These objects are used widely as parameters to the member functions of Windows classes in the class library. Because CPoint, CSize, and CRect correspond to the POINT, SIZE, and RECT structures, respectively, in the Windows SDK, you can use objects of these C++ classes wherever you can use these C-language structures. The classes provide useful interfaces through their member functions. CStringT provides very flexible dynamic character strings. CTime, COleDateTime, CTimeSpan, and COleTimeSpan represent time and date values. For more information about these classes, see the article Date and Time.

The classes that begin with "COle" are encapsulations of data types provided by OLE. These data types can be used in Windows programs regardless of whether other OLE features are used.

CStringT Class

Holds character strings.


Holds absolute time and date values.


Wrapper for the OLE automation type DATE. Represents date and time values.


Holds relative time and date values.


Holds relative COleDateTime values, such as the difference between two COleDateTime values.


Holds coordinate (x, y) pairs.


Holds distance, relative positions, or paired values.


Holds coordinates of rectangular areas.


Provides the functionality of the Windows image list. Image lists are used with list controls and tree controls. They can also be used to store and archive a set of same-sized bitmaps.


Wrapper for the OLE automation type VARIANT. Data in VARIANTs can be stored in many formats.


Wrapper for the OLE automation type CURRENCY, a fixed-point arithmetic type, with 15 digits before the decimal point and 4 digits after.


Beginning with Visual C++ .NET, CRect, CSize, and CPoint have been modified to be usable in either ATL or MFC applications. In addition, CStringT has been added to provide an MFC-independent CString-like class. For more information on shared utility classes, see Shared Classes.

© 2015 Microsoft