Dela via


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.

  • CTime
    Holds absolute time and date values.

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

  • CTimeSpan
    Holds relative time and date values.

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

  • CPoint
    Holds coordinate (x, y) pairs.

  • CSize
    Holds distance, relative positions, or paired values.

  • CRect
    Holds coordinates of rectangular areas.

  • CImageList
    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.

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

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

    Note

    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.

See Also

Concepts

Class Library Overview