GetCurrencyFormat
The GetCurrencyFormat
function formats a number string as a currency string for a specified locale.
int GetCurrencyFormat(
LCID Locale, |
// locale for which
currency string is to be formatted |
DWORD dwFlags, |
// bit flag that
controls the function s operation |
LPCTSTR lpValue, |
// pointer to input
number string |
CONST CURRENCYFMT *lpFormat, |
// pointer to a
formatting information structure |
LPTSTR lpCurrencyStr, |
// pointer to
output buffer |
int cchCurrency |
// size of output
buffer |
); |
|
Parameters
Locale
Specifies the
locale for which the currency string is to be formatted. If lpFormat is
NULL, the function formats the string according to the currency format for this
locale. If lpFormat is not NULL, the function uses the locale only for
formatting information not specified in the CURRENCYFMT
This
parameter can be a locale identifier created by the MAKELCID
LOCALE_SYSTEM_DEFAULT |
Default
system locale. |
LOCALE_USER_DEFAULT |
Default
user locale. |
dwFlags
A bit flag
that controls the operation of the function. If lpFormat is non-NULL,
this parameter must be zero.
If lpFormat
is NULL, you can specify the LOCALE_NOUSEROVERRIDE flag to format the string
using the system default currency format for the specified locale; or you can
specify zero to format the string using any user overrides to the locale s
default currency format.
lpValue
Points to a
null-terminated string containing the number string to format.
This string
can contain only the following characters:
Characters 0 through 9
One decimal point (dot) if the number is a
floating-point value
A minus sign in the first character position
if the number is a negative value
All other
characters are invalid. The function returns an error if the string pointed to
by lpValue deviates from these rules.
lpFormat
Pointer to a CURRENCYFMT
If lpFormat
is NULL, the function uses the currency format of the specified locale.
lpCurrencyStr
Points to a
buffer to receive the formatted currency string.
cchCurrency
Specifies the
size, in bytes (ANSI version) or characters (Unicode version), of the lpCurrencyStr
buffer. If cchCurrency is zero, the function returns the number of bytes
or characters required to hold the formatted currency string, and the buffer
pointed to by lpCurrencyStr is not used.
Return Values
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 lpCurrencyStr,
or if the cchCurrency parameter is zero, the number of bytes or
characters required to hold the formatted currency string.
If the
function fails, the return value is zero. To get extended error information,
call GetLastError
ERROR_INSUFFICIENT_BUFFER
ERROR_INVALID FLAGS
ERROR_INVALID_PARAMETER
See Also