Expand Minimize

GetUserDefaultLocaleName function

Retrieves the user default locale name.

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

Syntax


int GetUserDefaultLocaleName(
  _Out_  LPWSTR lpLocaleName,
  _In_   int cchLocaleName
);

Parameters

lpLocaleName [out]

Pointer to a buffer in which this function retrieves the locale name.

cchLocaleName [in]

Size, in characters, of the buffer indicated by lpLocaleName. The maximum possible length of a locale name, including a terminating null character, is LOCALE_NAME_MAX_LENGTH. This is the recommended size to supply in this parameter.

Return value

Returns the size of the buffer containing the locale name, including the terminating null character, if successful.

Note  On single-user systems, the return value is the same as that returned by GetSystemDefaultLocaleName.

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:

  • ERROR_INSUFFICIENT_BUFFER. A supplied buffer size was not large enough, or it was incorrectly set to NULL.

Remarks

This function can retrieve data from custom locales. Data is not guaranteed to be the same from computer to computer or between runs of an application. If your application must persist or transmit data, see Using Persistent Locale Data.

Windows Phone 8: This API is supported.

Windows Phone 8.1: This API is supported.

Requirements

Minimum supported client

Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 [desktop apps | Windows Store apps]

Header

Winnls.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

National Language Support
National Language Support Functions
GetLocaleInfoEx
GetSystemDefaultLocaleName
GetUserDefaultLCID

 

 

Community Additions

ADD
Show:
© 2014 Microsoft