I need to make an application(D2006) independent of Regional Settings, most important all the dateformats must be the same.
For the begging 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 make/take care?
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.
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.
来源:https://stackoverflow.com/questions/8786673/delphi-application-independent-of-regional-settings