如题?

解决方案 »

  1.   

    COleCurrency::Format
    CString Format( DWORD dwFlags = 0, LCID lcid = LANG_USER_DEFAULT );Return ValueA CString that contains the formatted currency value.ParametersdwFlagsIndicates flags for locale settings, possibly the following flag: LOCALE_NOUSEROVERRIDE   Use the system default locale settings, rather than custom user settings. 
    lcidIndicates locale ID to use for the conversion.ResCall this member function to create a formatted representation of the currency value. It formats the value using the national language specifications (locale IDs). A currency symbol is not included in the value returned. If the status of this COleCurrency object is null, the return value is an empty string. If the status is invalid, the return string is specified by the string resource IDS_INVALID_CURRENCY.ExampleCOleCurrency curA;           // value: 0.0000
    curA.SetCurrency(4, 500);    // value: 4.0500// value returned: 4.05
    curA.Format(0, MAKELCID(MAKELANGID(LANG_CHINESE,
         SUBLANG_CHINESE_SINGAPORE), SORT_DEFAULT));
    // value returned: 4,05
    curA.Format(0, MAKELCID(MAKELANGID(LANG_GERMAN,
         SUBLANG_GERMAN_AUSTRIAN), SORT_DEFAULT));Note   For a discussion of locale ID values, see the sectionSupporting Multiple National Languages in the Win32 SDK OLE Programmer’s Reference.
      

  2.   

    string to currency:
    case adCurrency: //6
    var->vt = VT_CY;
    cy.Lo = atoi(strValue);
    cy.int64 = atoi(strValue);
    var->cyVal = cy;
    break;currency to string:
    case VT_CY: 
    var_currency = var;
    strValue = var_currency.Format(0);
    break; 
    这样哪里不对?