COleCurrency::COleCurrency

Constructs a COleCurrency object.

COleCurrency( );
COleCurrency(
   CURRENCY cySrc 
);
COleCurrency(
   const COleCurrency& curSrc 
);
COleCurrency(
   const VARIANT& varSrc 
);
COleCurrency(
   long nUnits,
   long nFractionalUnits 
);

Parameters

  • cySrc
    A CURRENCY value to be copied into the new COleCurrency object.

  • curSrc
    An existing COleCurrency object to be copied into the new COleCurrency object.

  • varSrc
    An existing VARIANT data structure (possibly a COleVariant object) to be converted to a currency value (VT_CY) and copied into the new COleCurrency object.

  • nUnits, nFractionalUnits
    Indicate the units and fractional part (in 1/10,000's) of the value to be copied into the new COleCurrency object.

Remarks

All of these constructors create new COleCurrency objects initialized to the specified value. A brief description of each of these constructors follows. Unless otherwise noted, the status of the new COleCurrency item is set to valid.

  • COleCurrency( )   Constructs a COleCurrency object initialized to 0 (zero).

  • COleCurrency( cySrc )   Constructs a COleCurrency object from a CURRENCY value.

  • COleCurrency( curSrc )   Constructs a COleCurrency object from an existing COleCurrency object. The new object has the same status as the source object.

  • COleCurrency( varSrc )   Constructs a COleCurrency object. Attempts to convert a VARIANT structure or COleVariant object to a currency (VT_CY) value. If this conversion is successful, the converted value is copied into the new COleCurrency object. If it is not, the value of the COleCurrency object is set to zero (0) and its status to invalid.

  • COleCurrency( nUnits**,** nFractionalUnits )   Constructs a COleCurrency object from the specified numerical components. If the absolute value of the fractional part is greater than 10,000, the appropriate adjustment is made to the units. Note that the units and fractional part are specified by signed long values.

For more information, see the CURRENCY and VARIANT entries in the Windows SDK.

Example

The following examples show the effects of the zero-parameter and two-parameter constructors:

COleCurrency curZero;         // value: 0.0000
COleCurrency curA(4, 500);    // value: 4.0500
COleCurrency curB(2, 11000);  // value: 3.1000
COleCurrency curC(2, -50);    // value: 1.9950

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::SetCurrency

COleCurrency::operator =

COleCurrency::GetStatus

COleCurrency::m_cur

COleCurrency::m_status

Other Resources

COleCurrency Members