COleCurrency::ParseCurrency

BOOL ParseCurrency( LPCTSTR lpszCurrency, DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );
throw( CMemoryException );
throw( COleException );

Return Value

Nonzero if the string was successfully converted to a currency value, otherwise 0.

Parameters

lpszCurrency

A pointer to the null-terminated string which is to be parsed.

dwFlags

Indicates flags for locale settings, possibly the following flag:

lcid

Indicates locale ID to use for the conversion.

Remarks

Call this member function to parse a string to read a currency value. It uses national language specifications (locale IDs) for the meaning of nonnumeric characters in the source string.

For a discussion of locale ID values, see the section Supporting Multiple National Languages in the Win32 SDK OLE Programmer’s Reference.

If the string was successfully converted to a currency value, the value of this COleCurrency object is set to that value and its status to valid.

If the string could not be converted to a currency value or if there was a numerical overflow, the status of this COleCurrency object is invalid.

If the string conversion failed due to memory allocation errors, this function throws a CMemoryException. In any other error state, this function throws a COleException.

Example

// works if default locale has dot decimal point
COleCurrency cur;
cur.ParseCurrency("$135.95", 0);
ASSERT(cur == COleCurrency(135, 9500));

COleCurrency OverviewClass MembersHierarchy Chart

See Also   COleCurrency::Format, COleCurrency::GetStatus