[fpc-devel] GetLocaleInfo strange result in Windows 7
LacaK
lacak at zoznam.sk
Fri Jan 21 14:03:23 CET 2011
Hi *,
consider following sample program:
var
b: array[0..255] of char;
begin
if getlocaleinfoa(LOCALE_USER_DEFAULT, LOCALE_SSHORTDATE, b,
sizeof(b)) > 0 then
writeln('LOCALE_USER_DEFAULT:',b);
if getlocaleinfoa(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, b,
sizeof(b)) > 0 then
writeln('LOCALE_SYSTEM_DEFAULT:',b);
if getlocaleinfoa(GetThreadLocale, LOCALE_SSHORTDATE, b, sizeof(b)) >
0 then
writeln('GetThreadLocale:',b);
end;
In Windows XP/Vista returns:
LOCALE_USER_DEFAULT:d. M. yyyy
LOCALE_SYSTEM_DEFAULT:d. M. yyyy
GetThreadLocale:d. M. yyyy <--IS OK
In Windows 7 returns:
LOCALE_USER_DEFAULT:d. M. yyyy
LOCALE_SYSTEM_DEFAULT:d. M. yyyy
GetThreadLocale:M/d/yyyy <--HERE IS PROBLEM
So because calls to getlocaleinfo with argument GetThreadLocale is used
to initialize DefaultFormatSettings, in Windows 7 are some locale
specific global variables (ShortDateFormat, DateSeparator etc.)
initialized incorrectly.
Has anybody else this experience ?
Now I find:
http://qc.embarcadero.com/wc/qcmain.aspx?d=80189
http://stackoverflow.com/questions/1767946/getthreadlocale-returns-different-value-than-getuserdefaultlcid
So can you fix this problem somewhere in initialization process ?
Thanks
-Laco.
More information about the fpc-devel
mailing list