EnumUILanguagesW function (winnls.h)
Enumerates the user interface languages that are available on the operating system and calls the callback function with every language in the list.
Syntax
BOOL EnumUILanguagesW(
[in] UILANGUAGE_ENUMPROCW lpUILanguageEnumProc,
[in] DWORD dwFlags,
[in] LONG_PTR lParam
);
Parameters
[in] lpUILanguageEnumProc
Pointer to an application-defined EnumUILanguagesProc callback function. EnumUILanguages calls this function repeatedly to enumerate the languages in the list.
[in] dwFlags
Flags identifying language format and filtering. The following flags specify the format of the language to pass to the callback function. The format flags are mutually exclusive, and MUI_LANGUAGE_ID is the default.
Value | Meaning |
---|---|
|
Pass the language identifier in the language string to the callback function. |
|
Pass the language name in the language string to the callback function. |
The following flags specify the filtering for the function to use in enumerating the languages. The filtering flags are mutually exclusive, and the default is MUI_LICENSED_LANGUAGES.
Windows Vista and later: The application can set dwFlags to 0, or to one or more of the specified flags. A setting of 0 causes the parameter value to default to MUI_LANGUAGE_ID | MUI_LICENSED_LANGUAGES.
Windows 2000, Windows XP, Windows Server 2003: The application must set dwFlags to 0.
[in] lParam
Application-defined value.
Return value
Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call GetLastError, which can return one of the following error codes:
- ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
- ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.
Remarks
This function enumerates the user interface languages that are available and, depending on the flag specified, licensed for use on the operating system. It passes language identifiers or language names, one at a time, to the EnumUILanguagesProc callback function. The EnumUILanguages function continues to pass language identifiers or names to the callback function until the last language is found or the callback function returns FALSE.
For applications that run only on Windows Vista and later, MUI_LANGUAGE_NAME is recommended over MUI_LANGUAGE_ID. MUI_LANGUAGE_NAME allows differentiation between languages that are associated with a supplemental locale.
If the MUI_LANGUAGE_ID flag is specified in the call to this function, the strings passed to the callback
function will be hexadecimal language identifiers that do not include the leading 0x, and will be 4
characters in length. For example, en-US will be passed as "0409" and en as "0009". The value "1000" is passed to the callback function for any language associated with a supplemental locale. This value corresponds to the hexadecimal value of LOCALE_CUSTOM_UNSPECIFIED. It does not distinguish among supplemental locales, even if the selected language is in the user preferred UI languages list or the system preferred UI languages list.
C# Signature
[DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
static extern System.Boolean EnumUILanguages(
EnumUILanguagesProc lpUILanguageEnumProc,
System.UInt32 dwFlags,
System.IntPtr lParam
);
Note
The winnls.h header defines EnumUILanguages as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps | UWP apps] |
Minimum supported server | Windows 2000 Server [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winnls.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |