History: MfcSatelliteDlls

Preview of version: 7

MFC Satellite DLLs

I only recently learned, that MFC version 7.0 and later have support for satellite DLLs. After a little investigation, I found that this mechanism works fundamentally better than having resources for multiple languages compiled into the main application.

The problem with compiling multiple languages into an MFC application, is that there is no easy way to switch between languages. Originally, this was possible with the Win32 function SetThreadLocale, but Microsoft broke this functionality (presumably by design) as long ago as Windows 2000. Loading language specific dialog and menu-resources requires additional code in each affected component.

If you compile language resources into a separate DLL, all you have to do is load the DLL with LoadLibrary() and then call AfxSetResourceHandle() with the module handle (HMODULE) of the DLL. Providing all resources are present in the DLL, this seems to work perfectly.

In Version 4.7x.0028 of the Add-In, there is now build in support for MFC satellite DLLs. I will try to explain the details in this article.

Selecting MFC satellite DLL support

You can select support for MFC satellite DLLs for the current project using the project properties dialog, shown here on the right

You can set the default for new projects using the Add-in settings dialog, shown below.
Image
Image
You can access these two dialogs using the toolbar buttons indicated here.
Image

Satellite DLL projects

If you have selected satellite DLL Support, then the Add-In will create an additional project to generate the DLL, for each language in your project.

You can see these DLL projects in the solution explorer window in the following screenshot.
Image

The DLL projects are created with the following settings:

  • Project name is based on the original project name, with the language tag as a suffix, e.g. scribble_ko for the Korean language DLL.
  • Project directory is a subdirectory of the main project directory.
  • No entry point which means that the DLL does not need to contain any code at all.
    Image
  • Output directory is a subdirectory of the output directory in the main project
    Image


The directory structure is illustrated below:
Image



History

Information Version
Sat 05 of Feb, 2011 16:39 GMT Phil 14
Sat 17 of Jul, 2010 13:20 GMT Phil 13
Fri 16 of Jul, 2010 22:11 GMT Phil 12
Fri 16 of Jul, 2010 22:05 GMT Phil 11
Fri 16 of Jul, 2010 21:43 GMT Phil 10
Fri 16 of Jul, 2010 21:29 GMT Phil 9
Fri 16 of Jul, 2010 21:09 GMT Phil 8
Fri 16 of Jul, 2010 20:54 GMT Phil 7
Fri 16 of Jul, 2010 20:30 GMT Phil 6
Fri 16 of Jul, 2010 20:13 GMT Phil 5
Fri 16 of Jul, 2010 20:09 GMT Phil 4
Fri 16 of Jul, 2010 20:08 GMT Phil 3
Fri 16 of Jul, 2010 20:05 GMT Phil 2
Thu 15 of Jul, 2010 22:54 GMT Phil 1