Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2008 Feb : How to retrieve original FormatSettings of given locale ID?
| Subject: | How to retrieve original FormatSettings of given locale ID? |
| Posted by: | "Chau Chee Yang" (c..@sql.com.my) |
| Date: | Wed, 27 Feb 2008 17:48:09 |
Hi,
There are some SysUtils functions accept TFormatSettings as parameter
and return the value format based on TFormatSettings. e.g: DateToStr.
I usually use GetLocaleFormatSettings to retrieve TFormatSetting before
calling those functions. However, there is a weakness with the
GetLocaleFormatSettings function, it retrieve the user overridden format
setting in windows regional setting.
I wish to retrieve a copy the untouch FormatSettings even if user has
changed in regional settings. I found out the GetLocalFormatSettings
code is written like:
ShortDateFormat := TranslateDateFormat(GetLocaleStr(DefaultLCID,
LOCALE_SSHORTDATE, 'm/d/yy'));
If we pass LOCALE_NOUSEROVERRIDE to GetLocalStr:
GetLocaleStr(DefaultLCID, LOCALE_SSHORTDATE or LOCALE_NOUSEROVERRIDE,
'm/d/yy'));
We will get the original copy of the value. I have google and search in
the vcl source but couldn't find anything similar. Is there any good
ways to overcome this? Please advice. Thank you.
--
Best regards,
Chau Chee Yang
E Stream Software Sdn Bhd
URL: www.sql.com.my
SQL Financial Accounting