Export (0) Print
Expand All


Windows Mobile 6.5
A version of this page is also available for

This function formats a number string as a currency string for a specified locale.

If you specify a locale with the LCID (Locale ID) parameter and that locale is not installed or available on the Windows® phone, the function fails with ERROR_INVALID_PARAMETER. To determine whether the locale is supported or not, call IsValidLocale.

int GetCurrencyFormat(
  LCID Locale, 
  DWORD dwFlags, 
  LPCTSTR lpValue, 
  const CURRENCYFMT* lpFormat, 
  LPTSTR lpCurrencyStr, 
  int cchCurrency 


[in] Value that 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 structure (for example, the locale's string value for the negative sign).

This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values. The following table shows the values this parameter can take.

Value Description


Default system locale.


Default user locale.


Default language-neutral locale.


[in] 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.


[in] Pointer to a null-terminated string that contains 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.


[in] Pointer to a CURRENCYFMT structure that contains currency formatting information. All members in the structure pointed to by lpFormat must contain appropriate values.

If lpFormat is NULL, the function uses the currency format of the specified locale.


[out] Pointer to a buffer to receive the formatted currency string.


[in] Size, in characters, 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.

The number of characters written to the buffer pointed to by lpCurrencyStr, or, if the cchCurrency parameter is zero, the number of characters required to hold the formatted currency string indicates success. The count includes the terminating null. Zero indicates failure. To get extended error information, call the GetLastError function. The following table shows possible return values for the GetLastError function.

Value Description


The data area passed to a system call is too small.


The flags are invalid.


The parameter is incorrect, or the specified LCID is not supported on the device.

Windows Embedded CEWindows CE .NET 4.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

© 2014 Microsoft