Partager via


CComCurrency::CComCurrency

The constructor.

CComCurrency( ) throw( ); 
CComCurrency(
   const CComCurrency& curSrc 
) throw( );
CComCurrency(
   CURRENCY cySrc 
) throw( );
CComCurrency(
   DECIMAL dSrc 
);
CComCurrency(
   ULONG ulSrc 
);
CComCurrency(
   USHORT usSrc 
);
CComCurrency(
   CHAR cSrc 
);
CComCurrency(
   DOUBLE dSrc 
);
CComCurrency(
   FLOAT fSrc 
);
CComCurrency(
   LONG lSrc 
);
CComCurrency(
   SHORT sSrc 
);
CComCurrency(
   BYTE bSrc 
);
CComCurrency(
   LONGLONG nInteger,
   SHORT nFraction 
);
explicit CComCurrency(
   LPDISPATCH pDispSrc 
);
explicit CComCurrency(
   const VARIANT& varSrc 
);
explicit CComCurrency(
   LPCWSTR szSrc 
);
explicit CComCurrency(
   LPCSTR szSrc 
);

Parameters

  • curSrc
    An existing CComCurrency object.

  • cySrc
    A variable of type CURRENCY.

  • bSrc, dSrc, fSrc, lSrc, sSrc, ulSrc, usSrc
    The initial value given to the member variable m_currency.

  • cSrc
    A character containing the initial value given to the member variable m_currency.

  • nInteger, nFraction
    The integer and fractional components of the initial monetary value. See the CComCurrency overview for more information.

  • pDispSrc
    An IDispatch pointer.

  • varSrc
    A variable of type VARIANT. The locale of the current thread is used to perform the conversion.

  • szSrc
    A Unicode or ANSI string containing the initial value. The locale of the current thread is used to perform the conversion.

Remarks

The constructor sets the initial value of CComCurrency::m_currency, and accepts a wide range of data types, including integers, strings, floating-point numbers, CURRENCY variables, and other CComCurrency objects. If no value is provided, m_currency is set to 0.

In the event of an error, such as an overflow, the constructors lacking an empty exception specification (throw()) call AtlThrow with an HRESULT describing the error.

When using floating-point or double values to assign a value, note that CComCurrency(10.50) is equivalent to CComCurrency(10,5000) and not CComCurrency(10,50).

Requirements

Header: atlcur.h

See Also

Reference

CComCurrency Class

Other Resources

CComCurrency Members