52 lines
1.2 KiB
C++
52 lines
1.2 KiB
C++
// gzCurrencyFormatter.cpp: implementation of the CgzCurrencyFormatter class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "gzCurrencyFormatter.h"
|
|
#include "comdef.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CgzCurrencyFormatter::CgzCurrencyFormatter()
|
|
{
|
|
|
|
}
|
|
|
|
CgzCurrencyFormatter::~CgzCurrencyFormatter()
|
|
{
|
|
|
|
}
|
|
|
|
CString CgzCurrencyFormatter::Format(COleCurrency crData)
|
|
{
|
|
|
|
|
|
//this function takes an OleCurrency variable
|
|
//and returns a localized string representation
|
|
//including the currency symbol
|
|
//NOTE: Requires Dcom 1.2 on win95 stations
|
|
//and SP 4 or greater on win nt 4 stations.
|
|
//may not work on NT 3
|
|
//win98 and 2000 ok as is
|
|
//since these are also the requirements for the MDAC
|
|
//stuff it should be fine to use this routine.
|
|
|
|
|
|
BSTR bstrValue;
|
|
_variant_t vData;
|
|
vData=crData;
|
|
CString cstrValue;
|
|
VarFormatCurrency(&vData,-1,-2,-2,-2,0,&bstrValue);
|
|
cstrValue=bstrValue;
|
|
return cstrValue;
|
|
}
|