TN056: Installation of MFC Components

This note describes the requirements for installation of any component that uses the MFC DLL(s), including CTL3D32.DLL. The components related to ODBC and DAO require special considerations and are not discussed here. Please refer to the documentation for those components for further information.

DLLs and Version Marks

The MFC DLL(s) are what is called a shared DLL. For the Win32 version of MFC, there is potentially only one MFC DLL that you need to install with your application: MFC4x.DLL or a later version. This single DLL contains all code necessary for core MFC, MFC/OLE, MFC/Database, and the MFC/Network classes (previous versions had each of these components broken out into separate DLLs).

For the Macintosh version of MFC, these are still separate DLLs: MFC4x.DLL, MFCO4x.DLL, and MFCD4x.DLL (or later versions). Even if your application does not use all of the MFC DLLs (perhaps you do not use the OLE or Database functionality of MFC, for example), you must install all of the MFC DLLs as a set. Anything else would result in mismatched components. This is important because there is no guarantee that a later version of MFC4x.DLL will work with version 4.x of MFCO4x.DLL.

Because these DLLs are shared components, they reside in the Windows “system” directory. That is, they should be installed into the directory indicated by the return value from GetSystemDirectory. Installing in this directory, like other shared system components, must be done carefully to avoid overwriting newer versions of the DLL that other applications previously installed may be relying upon. To retrieve the version information for the installed files, use the GetFileVersionInfo APIs provided by the Windows version API. You should only install a new DLL if its version information, give by the dwFileVersionMS and dwFileVersionLS fields of the VS_FIXEDFILEINFO structure are larger than the same version information of the already installed DLL.

Finally, if your application uses CTL3D32.DLL (if it calls CWinApp::Enable3dControls), you will need to install the correct version of CTL3D32.DLL into the system directory, again being careful to check that a newer version does not already exist. In addition, the version of CTL3D32.DLL that you install is different depending on the platform you are installing on. For Windows version 4.0 and greater, CTL3D32.DLL is not used under any circumstances, so it should not be installed (this includes Windows 95 and Windows NT 4.0). For Win32s, \WIN32S\REDIST\CTL3D32.DLL should be installed into the system directory. For Windows NT 3.xx, \MSDEV\CTL3D32.DLL should be installed into the system directory. Each of these DLLs is specific to the target platform, even though they have the same name. The Win32s version will refuse to run on Windows NT; the Windows NT version will refuse to run on Win32s.

Localization Considerations

If your application has chosen to localize its use of the MFC resources by installing MFC4xLOC.DLL or a later version, you will need to follow the instructions in this section. Like other shared DLLs, MFC4xLOC.DLL should only be installed if its version is newer than the version which is already installed. As a result installing this DLL is very similar to installing the other MFC DLL(s). There are a couple of exceptions.

First, you should never install MFC4xLOC.DLL on an English system. English resources are built into MFC4x.DLL and it is faster to load them from that DLL instead of searching (and loading) MFC4xLOC.DLL first.

Second, there are multiple versions of MFC4xLOC.DLL – one for each locale. Their names are based on the locale. For example MFC4xDEU.DLL is the German version of MFC4xLOC.DLL – it contains version information that identifies it as German locale; MFC4xESP.DLL, similarly, is the Spanish version of the DLL. If you install it, you must insure that 1) the locale for which it is intended matches the locale of the Windows system that is installed, and 2) that the locale is not different from the locale of the MFC4xLOC.DLL already installed (if it is installed). If these two conditions cannot be satisfied, then the DLL should not be overwritten. If the version mark on the existing MFC4xLOC.DLL is equal to or greater than the version mark in your distribution, then you’re product will work once installed. It may have mixed resources (some of one language, some of another), but it will work. If the version mark on the existing DLL is less than your distribution and the locale is mismatched, your product may not work once installed. You should warn the user of this mismatch and back out of your installation process. The user will have to resolve the conflict between this DLL and your product before continuing.

Important   Obviously, this can add a lot of complexity to your installation as well as hassles for your end user if they use and install a mix of different localized applications (some applications localized to one language, and some to another). Because of this difficulty, it is highly recommended that you do not ship any version of MFC4xLOC.DLL. Instead, include the appropriate MFC implementation resources in your module itself and avoid this whole issue. See Technical Note 57 for more information on this subject.

Technical Notes by NumberTechnical Notes by Category