SetThreadLocale function (winnls.h)

Sets the current locale of the calling thread.

Syntax

BOOL SetThreadLocale(
  [in] LCID Locale
);

Parameters

[in] Locale

Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of the following predefined values.

Return value

The function should return an LCID on success. This is the LCID of the previous thread locale.

Remarks

When a thread is created, it uses the user locale. This value is returned by GetUserDefaultLCID. The user locale can be modified for future processes and thread creation using the regional and language options portion of the Control Panel. The thread locale can also be changed using SetThreadLocale.

SetThreadLocale affects the selection of resources with a LANGUAGE statement. The statement affects such functions as CreateDialog, DialogBox, LoadMenu, LoadString, and FindResource. It sets the code page implied by CP_THREAD_ACP, but does not affect FindResourceEx. For more information, see Code Page Identifiers.

Windows Vista and later: Do not use SetThreadLocale to select a user interface language. The resource loader selects the resource that is defined in the .rc file with a LANGUAGE statement, or the application can use FindResourceEx. Additionally, the application can use SetThreadUILanguage.

Windows 2000, Windows XP: Do not use SetThreadLocale to select a user interface language. To select the resource that is defined in the .rc file with a LANGUAGE statement, the application must use the FindResourceEx function.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

GetSystemDefaultLCID

GetThreadLocale

GetUserDefaultLCID

National Language Support

National Language Support Functions