Home | API | MFC | C++ | C | Previous

Programming Windows with MFC

MFC Collections Classes

The MFC library provides a rich series of collection classes aimed at providing an easy and safe way to manage dynamic data. The MFC library collection classes are divided into two categories: template-based and non-template classes.

The Template Classes

CArray – Supports arrays that can dynamically reduce and grow as necessary.
For further detailed reading – https://docs.microsoft.com/en-us/cpp/mfc/reference/carray-class?view=vs-2019

CList – supports ordered lists of nonunique objects accessible sequentially or by value.
https://docs.microsoft.com/en-us/cpp/mfc/reference/clist-class?view=vs-2019

CMap – is a dictionary collection class that maps unique keys to values
https://docs.microsoft.com/en-us/cpp/mfc/reference/cobject-class?view=vs-2019

CtypedPtrArray – Provides a type-safe “wrapper” for objects of class CPtrArray or CObArray.
https://docs.microsoft.com/en-us/cpp/mfc/reference/ctypedptrarray-class?view=vs-2019

CTypedPtrList – Provides a type-safe “wrapper” for objects of class CPtrList
https://docs.microsoft.com/en-us/cpp/mfc/reference/ctypedptrlist-class?view=vs-2019

CTypedPtrMap – Provides a type-safe “wrapper” for objects of the pointer-map classes CMapPtrToPtr, CMapPtrToWord, CMapWordToPtr, and CMapStringToPtr.
https://docs.microsoft.com/en-us/cpp/mfc/reference/ctypedptrmap-class?view=vs-2019

The Non-Template Classes

CObArray – Supports arrays of CObject pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cobarray-class?view=vs-2019

CByteArray – Supports dynamic arrays of bytes.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cbytearray-class?view=vs-2019

CDWordArray – Supports arrays of 32-bit doublewords.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cdwordarray-class?view=vs-2019

CPtrArray – Supports arrays of void pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cptrarray-class?view=vs-2019

CStringArray – Supports arrays of CString objects.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cstringarray-class?view=vs-2019

CWordArray – Supports arrays of 16-bit words
https://docs.microsoft.com/en-us/cpp/mfc/reference/cwordarray-class?view=vs-2019

CUIntArray – Supports arrays of unsigned integers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cuintarray-class?view=vs-2019

CObList – Supports ordered lists of nonunique CObject pointers accessible sequentially or by pointer value.
https://docs.microsoft.com/en-us/cpp/mfc/reference/coblist-class?view=vs-2019

CPtrList – Supports lists of void pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cptrlist-class?view=vs-2019

CStringList – Supports lists of CString objects.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cstringlist-class?view=vs-2019

CmapPtrToWord – Supports maps of 16-bit words keyed by void pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapptrtoword-class?view=vs-2019

CMapPtrToPtr – Supports maps of void pointers keyed by void pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapptrtoptr-class?view=vs-2019

CMapStringToOb – A dictionary collection class that maps unique CString objects to CObject pointers.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapstringtoob-class?view=vs-2019

CMapStringToPtr – Supports maps of void pointers keyed by CString objects.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapstringtoptr-class?view=vs-2019

CMapStringToString – Supports maps of CString objects keyed by CString objects.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapstringtostring-class?view=vs-2019

CMapWordToOb – Supports maps of CObject pointers keyed by 16-bit words
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapwordtoob-class?view=vs-2019

CMapWordToPtr – Supports maps of void pointers keyed by 16-bit words.
https://docs.microsoft.com/en-us/cpp/mfc/reference/cmapwordtoptr-class?view=vs-2019

Simple Data Type Classes

MFC supplies a number of classes to encapsulate various data types widely used as parameters to the member functions of Windows classes. These are

CStringT – Holds character strings.
CTime – Holds absolute time and date values.
COleDateTime – Wrapper for the OLE automation type DATE.
CTimeSpan – Holds relative time and date values.
COleDateTimeSpan – Holds relative 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.
COleVariant – Wrapper for the OLE automation type VARIANT
COleCurrency – Wrapper for the OLE automation type CURRENCY

For further detailed reading

https://docs.microsoft.com/en-us/cpp/mfc/simple-data-type-classes?view=vs-2019

File Input and Output

MFC encapsulates the windows API file handling functions in the CFile class. If includes member functions for opening and closing files, reading and writing file data, deleting and renaming files, and retrieving file information. For a full description of the Cfile class and associated member function go to the following. For further reading

https://docs.microsoft.com/en-us/cpp/mfc/reference/cfile-class?view=vs-2019


Home | API | MFC | C++ | C | Previous
Creating a Simple Window | Processing Messages | Device Context | Working with Graphics | Mapping Modes | Text Output | Working with the Mouse | Dealing with Keyboard Input | Drawing Lines and Shapes | Adding Menus | Child Windows | Dialog Windows | Common Dialog Box | Working with Bitmaps | Common Controls | Toolbars | Document View Architecture | Multi Document Interface | Timers | MFC Collections Classes

Last Updated: 16 October 2022