SetThreadUILanguage function (winnls.h)
Sets the user interface language for the current thread.
Windows Vista and later: This function cannot clear the thread preferred UI languages list. Your MUI application should call SetThreadPreferredUILanguages to clear the language list.
Windows XP: This function is limited to allowing the operating system to identify and set a value that is safe to use on the Windows console.
Syntax
LANGID SetThreadUILanguage(
[in] LANGID LangId
);
Parameters
[in] LangId
Language identifier for the user interface language for the thread.
Windows Vista and later: The application can specify a language identifier of 0 or a nonzero identifier. For more information, see the Remarks section.
Windows XP: The application can only set this parameter to 0. This setting causes the function to select the language that best supports the console display. For more information, see the Remarks section.
Return value
Returns the input language identifier if successful. If the input identifier is nonzero, the function returns that value. If the language identifier is 0, the function always succeeds and returns the identifier of the language that best supports the Windows console. See the Remarks section.
If the input language identifier is nonzero and the function fails, the return value differs from the input language identifier. To get extended error information, the application can call GetLastError.
Remarks
When a thread is created, the thread user interface language setting is empty and the user interface for the thread is displayed in the user-selected language. This function enables the application to change the user interface language for the current running thread.
Windows Vista and later: Calling this function and specifying 0 for the language identifier is identical to calling SetThreadPreferredUILanguages with the MUI_CONSOLE_FILTER flag set. If the application specifies a valid nonzero language identifier, the function sets a particular user interface language for the thread. After specifying 0 for the language identifier, the application cannot use any of the following constants to correspond to a language identifier:
- LOCALE_SYSTEM_DEFAULT
- LOCALE_USER_DEFAULT
- LOCALE_CUSTOM_DEFAULT
- LOCALE_CUSTOM_UI_DEFAULT
- LOCALE_CUSTOM_UNSPECIFIED
C# Signature
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
static extern System.UInt16 SetThreadUILanguage(
System.UInt16 LangId
);
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | winnls.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |