Multi Language Software
Softwarebuero Jollans
This is Tikiwiki v2.2 -Arcturus- © 2002–2008 by the Tiki community
Sat 04 of Sept., 2010 23:21 CEST
MFC Satellite DLLsI 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
![]()
Satellite DLL projectsIf 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. ![]() The DLL projects are created with the following settings:
![]() Note that this structure is based on the structure used by Windows Forms projects in C# or VB.NET. I have deliberately decided not to use the three character abbreviations typically used by MFC projects (e.g. ENU for English), because I consider them to be out of date. Each satellite DLL project has two source files:
Language selection formThe Add-In now is not able to add a language selection form to an MFC project automatically. The command is in runtime-support menu, as shown here:![]() The language selection form is defined in three template files:
The Add-In will add the .h and .cpp files to your project and add the dialog resource to your .rc file. In addition, it will add code to your InitInstance function to show the language selection dialog. Code added to InitInstance() BOOL CScribbleApp::InitInstance()
{
CSelectLanguage sl ;
sl.LoadSettingsAndShow() ;This is what the code in the SelectLanguage form actually does:
This is what the select language dialog looks like when you start the application. ![]()
|








