20.2.2 Customizing an Application for Different Markets

You can use dynamic-link libraries for customizing your application for different markets. For each market, you would create a library containing code, data, and resources that would make your application more appropriate for that market. You need not design and compile a completely separate application module for each market. Instead, you need only create a general-purpose application that would draw upon the market-specific information contained in the library.

Dynamic-link libraries are often used to customize applications for international markets. The libraries can supply language- and culture-specific data for applications that are to be marketed in different countries. For example, an application could be shipped with its application module, APPFILE.EXE, and with three language-specific libraries: ENGLISH.DLL, FRENCH.DLL, and GERMAN.DLL.

When the product is installed, the correct language library could be selected and used for all dialog box templates, menus, string information, and other language-specific information.

When you use the resources of a library, you use the library's instance handle to identify it. You obtain the library instance handle by calling the LoadLibrary function:

HINSTANCE hLibrary;

hLibrary = LoadLibrary("FRENCH.DLL");

The hLibrary value could be used anywhere that an hinst value is requested for normal resource loading. For example, if the FRENCH.DLL library contains a menu template named MAINMENU, the application loads the library and then accesses the menu with the following call:

HMENU hMenu;

hMenu = LoadMenu(hLibrary, "MAINMENU");