Name

LoadResourceModule Function

Syntax

function LoadResourceModule(ModuleName: PChar): LongWord;

Description

Delphi automatically calls LoadResourceModule to load a language-specific DLL for an application. If no such DLL is found, the function returns zero; otherwise, it loads the DLL as a data file and returns the DLL’s instance handle.

When Delphi loads a module (application, DLL, or package), it automatically calls LoadResourceModule to look for a DLL whose name is the same as the module name, but with an extension that specifies a locale. LoadResourceModule looks for the locale extension in three places. At each step, it tries to load the locale-specific DLL, and if it fails, it tries the next step in the sequence:

  1. First, it checks the registry. It looks for the application’s full pathname under two registry keys:

  • HKEY_CURRENT_USER\Software\Borland\Delphi\Locales

  • HKEY_CURRENT_USER\Software\Borland\Locales

  1. If the application has an entry under either key, the value of that entry is the locale extension. If the application does not have an entry, but the key has a default value, the default value is the locale extension.

  2. Next, it looks for a DLL whose extension is the local language and country code.

  3. Finally, it looks for a DLL whose extension is just a language code.

If LoadResourceModule finds a DLL with the locale extension, it loads the DLL and returns the resource DLL’s instance handle. It also saves the instance handle so FindResourceHInstance will look for resources in the localized ...

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.