Share via


Application Object Samples

Every Windows application using the Microsoft Foundation Class Library must implement a CWinApp derived class and create only one object of that class. See the SCRIBBLE for an introduction to application objects and for an example of an application that relies on document template (CDocTemplate) objects to manage the creation of frame windows, document objects, and view objects.

Note   For an example of a console application that uses the Microsoft Foundation Class Library but does not have a CWinApp derived class, see the MAKEHM sample.

CWinApp provides the WinMain function required by Windows, implements the main message loop, and coordinates the creation of frame windows, documents, and views using document template objects. CWinApp also provides secondary functionality at the high application level. The following samples illustrate some of these secondary CWinApp features:

  • HIERSVR shows how to register an application's document type with the Window or Windows NT Explorer.
  • SUPERPAD shows how to use a wait cursor during long operations.
  • SUPERPAD and CHKBOOK show how to use a private .ini file using member functions provided by CWinApp.
  • SUPERPAD and CTRLBARS show how to override CWinApp::OnIdle.

If your application does not lend itself to a document/view architecture, you do not have to use document templates, documents, and views, as illustrated in the following samples:

  • HELLO is an application that has a single application window, without documents and views. HELLO is slightly more complicated than the minimal HELLOAPP sample.
  • HELLOAPP is a minimal MFC application.
  • MDI has a multiple document interface (MDI) application without documents and views.
  • SPEAKN has a single dialog box as the user interface.

See Also

MFC Samples | Categorical List of MFC Samples