SoftwareSphere Home

MFCPlus Class Library

Installation

You can use this library in many ways, here we suggest a way of installing it and calling it from code.

  1. Choose a directory where to store the library files, for example C:\Development\MFCPlus or C:\Libraries\MFCPlus. Let's call it the MFCPlus root folder and represent it with MFXROOT.
  2. In this directory copy the two directories Include and Src, so
    MFXROOT\Include will contain the main header files
    MFXROOT\Src will contain all the source files and the detailed headers
  3. If you prefer to store the compiled libraries in a different folder then you can copy the lib and the dll files in that folders, otherwise copy the Lib and Bin folder.
    MFXROOT\Lib contains the lib files for all versions, both for static and dynamic libraries
    MFXROOT\Bin contains the compiled dll files
  4. Setup your development environment to use the library:
    1. Add the MFCPlus Include and Src folders to the list of folders for searching include files.
    2. Add the MFCPlus Lib folder to the list of folders for library files.
    3. Add the MFCPlus Bin folder to the system's PATH environment variable to let applications find the DLL when using the DLL version of the libraries. For example the PATH environment variable should look like this: SET PATH=C:\Libraries\MFCPlus\Bin;%PATH%;. Of course don't remove the other parts of the PATH environment variable already there.

With this installation the use of the library is straightforward, just add the include directive of the header of the package you need. It is better if these include directives are placed in the header that generates the precompiled header of your project so they are precompield and not parsed multiple times during builds. For example in the StdAfx.h header of your project (or any other header you are using for precompiled header):

#include <MFXFile.h>
#include <MFXApp.h>
#include <MFXDlg.h>

The headers will pass the names of the libraries to the linker. There are eight versions of the libraries depending on the following preprocessor flags:

_AFXDLL This selects if to use the DLLs or the static libraries. When _AFXDLL is defined the MFC library is used as a DLL and so the MFCPlus libraries, when it is not defined the MFC is used as a static library and so the MFCPlus libraries.
_DEBUG This selects the Debug or Release subconfigurations. If _DEBUG is defined then the debug versions are used and if it is not defined then the release versions are used. This happens for both the DLL and the static libraries.
_UNICODE This selects the character model, if _UNICODE is defined the the Unicode versions are used, otherwise the ASCII versions are used.

Library file names

The eight versions of the libraries are named with a three letter suffix as explained by the following table:

Static/DynamicDebug/ReleaseUnicode/AnsiCode
StaticDebugAnsiSDA
StaticReleaseAnsiSRA
StaticDebugUnicodeSDU
StaticReleaseUnicodeSRU
DynamicDebugAnsiDDA
DynamicReleaseAnsiDRA
DynamicDebugUnicodeDDU
DynamicReleaseUnicodeDRU

Notice that the version of the C/C++ library is chosen according to the _AFXDLL and the _DEBUG flags:

Static/DynamicDebug/ReleaseC/C++ library
StaticDebugDEBUG_MULTI_THREAD
StaticReleaseMULTI_THREAD
DynamicDebugDEBUG_MULTI_THREAD_DLL
DynamicReleaseMULTI_THREAD_DLL

The _UNICODE flag selects the C/C++ libraries subversion as well.