This may help:
http://objectmix.com/c/398307-setlocaleinfo-how-make-effect-immeadiate.html
- Code: Select all Expand view
- bool SetDecimalSeparator(char Separator)
{
bool blRetVal = true;
char * pDecSep = new char[2];
GetLocaleInfo(GetSystemDefaultLCID(),LOCALE_SDECIMAL,pDecSep,2);
if(Separator == '.' && pDecSep[0] != '.')
{
if(!SetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SDECIMAL, "."))
{
// PostMessage ??
blRetVal = false;
}
}
else if(Separator == ',' && pDecSep[0] != ',')
{
if(!SetLocaleInfo(GetSystemDefaultLCID(), LOCALE_SDECIMAL, ","))
{
// PostMessage ??
blRetVal = false;
}
}
delete[] pDecSep;
return blRetVal;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
SetDecimalSeparator('.');
}