Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 21: Tree and List Controls



  1. Close it and return to MSVC


22.3 MFC Static Libraries...................................................................................


22.3.1..Introduction..........................................................................................


An MFC static library is a library file that includes MFC functions or classes. Such a
library natively supports MFC strings (such as CString, CTime, etc), lists, and any other
C/C++ or MFC global functions. Because this library is an MFC type, it can be used only
by an MFC-based application.

22.3.2..Creation of an MFC Static Library...................................................


To create an MFC static library, from the New Project dialog box, select Win32 Project.
Then, in the Win32 Application Wizard, select the Static Library radio button in the
Application Type section and, in the Add Support For section, click the MFC check box.
The following two options are available:

??If you do not select the Precompiled Header radio button, an empty project would be
created
??If you select the Precompiled Header radio button, the wizard will generate a
StdAfx.h header file and a StdAfx.cpp source file for the project. The wizard will
also include the afx.h and the afxwin.h files in the StdAfx.h header file. You can still
add any necessary header file in StdAfx.h

Practical Learning: Creating a Static MFC Library



  1. To start a new project, on the main menu, click File -> New...

  2. In the New dialog box, click the Projects property page

  3. In the list, click Win32 Static Library

  4. In the Project Name edit box, type MFCExt

Free download pdf