共用方式為


COleCurrency::SetCurrency

Call this member function to set the units and fractional part of this COleCurrency object.

void SetCurrency( 
   long nUnits, 
   long nFractionalUnits  
);

Parameters

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

Remarks

If the absolute value of the fractional part is greater than 10,000, the appropriate adjustment is made to the units, as shown in the third of the following examples.

Note that the units and fractional part are specified by signed long values. The fourth of the following examples shows what happens when the parameters have different signs.

Example

COleCurrency curA;           // value: 0.0000
curA.SetCurrency(4, 500);    // value: 4.0500
curA.SetCurrency(2, 11000);  // value: 3.1000
curA.SetCurrency(2, -50);    // value: 1.9950

Requirements

Header: afxdisp.h

See Also

Reference

COleCurrency Class

Hierarchy Chart

COleCurrency::COleCurrency

COleCurrency::operator =

COleCurrency::m_cur