EnumSystemLocalesEx function (winnls.h)

Enumerates the locales that are either installed on or supported by an operating system.

Note  The application should call this function in preference to EnumSystemLocales if designed to run only on Windows Vista and later.


BOOL EnumSystemLocalesEx(
  [in]           LOCALE_ENUMPROCEX lpLocaleEnumProcEx,
  [in]           DWORD             dwFlags,
  [in]           LPARAM            lParam,
  [in, optional] LPVOID            lpReserved


[in] lpLocaleEnumProcEx

Pointer to an application-defined callback function. The EnumSystemLocalesEx function enumerates locales by making repeated calls to this callback function. For more information, see EnumLocalesProcEx.

[in] dwFlags

Flags identifying the locales to enumerate. The flags can be used singly or combined using a binary OR. If the application specifies 0 for this parameter, the function behaves as for LOCALE_ALL.

[in] lParam

An application-provided parameter to be passed to the callback function. This is especially useful for multi-threaded applications.

[in, optional] lpReserved

Reserved; must be NULL.

Return value

Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call GetLastError, which can return one of the following error codes:

  • ERROR_BADDB. The function could not access the data. This situation should not normally occur, and typically indicates a bad installation, a disk problem, or the like.
  • ERROR_INVALID_FLAGS. The values supplied for flags were not valid.
  • ERROR_INVALID_PARAMETER. Any of the parameter values was invalid.


This function enumerates locales by passing locale names, one at a time, to the application-defined callback function specified by lpLocaleEnumProcEx. Enumeration continues until all installed or supported names have been passed to the callback function or the callback function returns FALSE.

The choices for the dwFlags parameter are different from those for EnumSystemLocales, which must distinguish between installed and supported locales.

If dwFlags specifies LOCALE_ALTERNATE_SORTS, the callback function is called for every locale that represents an alternate sort order. For example, Spanish (Spain) defaults to international sort order, but traditional sort order is available for an alternate sort. German (Germany) defaults to dictionary sort order, but there is an alternate phone book sort order available.


An example showing the use of this function can be found in NLS: Name-based APIs Sample.


Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header winnls.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also



National Language Support

National Language Support Functions