Delphi - Application independent of Regional Settings

6.6k views Asked by At

I need to make an application(D2006) independent of Regional Settings, most important all the dateformats must be the same.

For the beginning I want to replace all the FormatDateTime('adateformate') with FormatDateTime('aConstantDefined'). Also Application.UpdateFormatSettings and Application.UpdateMetricSettings should be set to False.

Is there anything else I should take/change?

LE: problem is that I have users with 2 different Regional Settings, and they don't want to uniform their settings. I know that sounds strange, but this is the fact. So, this is the reason why I need to make my application totally independent of Regional Settings.

1

There are 1 answers

4
LU RD On BEST ANSWER

Apply your own TFormatSettings record. Call FormatDateTime('aConstantDefined',ADateTime,myFormatSettings) when appropriate.

This will avoid mishaps if your application changes the system format settings. So you don't have to use Application.UpdateFormatSettings and Application.UpdateMetricSettings.

Update :

I should add that all format string functions involved with regional settings, takes the TFormatSettings overloaded parameter. It is often used to make the application thread-safe, but comes in handy when overriding regional settings. I often use this technique when serializing/deserializing data for communication/storing purposes.