Mega Code Archive

 
Categories / Delphi / Examples
 

Set decimal separator systemwide

procedure SetDecimalSeparator(Ch: Char); var DefLCID: LCID; Buffer: LPSTR; begin Application.UpdateFormatSettings := True; StrPCopy(Buffer, Ch); DefLCID := GetThreadLocale; if SetLocaleInfo(DefLCID, LOCALE_SDecimal, Buffer) then DecimalSeparator := StrPas(Buffer)[1]; Application.UpdateFormatSettings := False; end; procedure TForm1.Button1Click(Sender: TObject); begin SetDecimalSeparator('.'); end;