The GetNumberFormat function formats a number string as a number string customized for a specified locale.
int GetNumberFormat(
LCID Locale, // locale for which string is to be formatted
DWORD dwFlags, // bit flag that controls the function's operation
LPCTSTR lpValue, // pointer to input number string
CONST NUMBERFMT *lpFormat, // pointer to a formatting information structure
LPTSTR lpNumberStr, // pointer to output buffer
int cchNumber // size of output buffer
);
This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values:
LOCALE_SYSTEM_DEFAULT | Default system locale. | ||
LOCALE_USER_DEFAULT | Default user locale. | ||
LOCALE_NEUTRAL | Default language-neutral locale. |
If lpFormat is NULL, you can specify the LOCALE_NOUSEROVERRIDE flag to format the string using the system default number format for the specified locale; or you can specify zero to format the string using any user overrides to the locale's default number format
This string can only contain the following characters:
All other characters are invalid. The function returns an error if the string pointed to by lpValue deviates from these rules.
If lpFormat is NULL, the function uses the number format of the specified locale.
If the function succeeds, the return value is the number of bytes (ANSI version) or characters (Unicode version) written to the buffer pointed to by lpNumberStr, or if the cchNumber parameter is zero, the number of bytes or characters required to hold the formatted number string. The count includes the terminating null.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes:
ERROR_INSUFFICIENT_BUFFER
ERROR_INVALID FLAGS
ERROR_INVALID_PARAMETER
Windows CE: The Locale parameter is ignored and the default system locale is always used. The Locale parameter should be set to LOCALE_SYSTEM_DEFAULT to ensure compatibility with future versions of Windows CE.
No flags are supported for the dwFlags parameter, it should be set to zero.
Windows NT: Requires version 3.5 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winnls.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
National Language Support Overview, National Language Support Functions, GetCurrencyFormat, NUMBERFMT