Internationalization and localization tools


Locale-Sensitive Windows C++ Function

HRSRC FindResource(HMODULE hModule, LPCTSTR lpName, LPCTSTR lpType);

HRSRC FindResourceEx(HMODULE hModule, LPCTSTR lpType, LPCTSTR lpName, WORD wLanguage);

Internationalization (I18n) Function Overview

The FindResource function uses the resource name, lpName, and type, lpType, and module, hModule, to find a resource. If successful, it returns a handle to the resource's information block; otherwise it returns NULL and sets extended error information that can be obtained by calling GetLastError.

FindResourceEx is an extension of FindResource in that it allows you to search for the resource within a specified language group, by passing the wLanguage parameter.

See FindResource and FindResourceEx for MSDN detailed information.

I18n Issues

To support resource modules that have resources in multiple languages, you will want to call FindResourceEx, which passes in a language ID (see MAKELANGID). However, be sure to check that the lpType and lpName parameters are in the correct order; they are in the reverse order of the FindResource method.

Recommended Replacements*

When possible, use the Generic version of the function, rather than the narrow or wide versions, and let the Windows #define UNICODE switch determine which version of the function will be called.

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

Locale-Sensitive Windows C++ Functions

 

Lingoport internationalization and localization services and software