LocaleNameToLCID

Converts a locale name to a locale identifier.

Note

For custom locales, including those created by Microsoft, your applications should prefer locale names over locale identifiers.

Syntax

LCID LocaleNameToLCID(
         LPCWSTR lpName,
         DWORD dwFlags
)  

Parameters

lpName
Type: LPCWSTR 

Pointer to a null-terminated string representing a locale name, or one of the following predefined values.

dwFlags
Type: DWORD 

Prior to Windows 7: Reserved; should always be 0. Beginning in Windows 7: Can be set to LOCALE_ALLOW_NEUTRAL_NAMES to allow the return of a neutral LCID.

Return value

Type: LCID 

Returns the locale identifier corresponding to the locale name if successful. If the supplied locale name corresponds to a custom locale that is the user default, this function returns LOCALE_CUSTOM_DEFAULT. If the locale name corresponds to a custom locale that is not the user default, the function returns LOCALE_CUSTOM_UNSPECIFIED.

The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, which can return one of the following error codes:

Remarks

Beginning in Windows 8: If your app passes language tags to this function from the Windows.Globalization namespace, it must first convert the tags by calling ResolveLocaleName.

Windows Phone 8: This API is supported.

Requirements

Header: Declared in winnls.h.

Library: Use kernelx.lib.