Поделиться через


Application and Thread Support Classes

Each application has one and only one application object; this object coordinates other objects in the running program and is derived from CWinApp.

The Microsoft Foundation Class (MFC) Library supports multiple threads of execution within an application. All applications must have at least one thread; the thread used by your CWinApp object is this primary thread.

CWinThread encapsulates a portion of the operating system's threading capabilities. To make using multiple threads easier, MFC also provides synchronization object classes to provide a C++ interface to Win32 synchronization objects.

Application and Thread Classes

  • CWinApp
    Encapsulates the code to initialize, run, and terminate the application. You will derive your application object from this class.

  • CWinThread
    The base class for all threads. Use directly, or derive a class from CWinThread if your thread performs user-interface functions. CWinApp is derived from CWinThread.

Synchronization Object Classes

  • CSyncObject
    Base class of the synchronization object classes.

  • CCriticalSection
    A synchronization class that allows only one thread within a single process to access an object.

  • CSemaphore
    A synchronization class that allows between one and a specified maximum number of simultaneous accesses to an object.

  • CMutex
    A synchronization class that allows only one thread within any number of processes to access an object.

  • CEvent
    A synchronization class that notifies an application when an event has occurred.

  • CSingleLock
    Used in member functions of thread-safe classes to lock on one synchronization object.

  • CMultiLock
    Used in member functions of thread-safe classes to lock on one or more synchronization objects from an array of synchronization objects.

  • CCommandLineInfo
    Parses the command line with which your program was started.

  • CWaitCursor
    Puts a wait cursor on the screen. Used during lengthy operations.

  • CDockState
    Handles persistent storage of docking state data for control bars.

  • CRecentFileList
    Maintains the most recently used (MRU) file list.

См. также

Основные понятия

Class Library Overview