Einzelnen Beitrag anzeigen

hathor
(Gast)

n/a Beiträge
 
#5

AW: Windows Gebietseinstellungen

  Alt 8. Nov 2013, 16:15
Funktion SetLocaleInfo

Delphi-Quellcode:
function SetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: PChar): Boolean;

//these are the LCTYPE constants:
LOCALE_ICALENDARTYPE
LOCALE_SDATE
LOCALE_ICURRDIGITS
LOCALE_SDECIMAL
LOCALE_ICURRENCY
LOCALE_SGROUPING
LOCALE_IDIGITS
LOCALE_SLIST
LOCALE_IFIRSTDAYOFWEEK
LOCALE_SLONGDATE
LOCALE_IFIRSTWEEKOFYEAR
LOCALE_SMONDECIMALSEP
LOCALE_ILZERO
LOCALE_SMONGROUPING
LOCALE_IMEASURE
LOCALE_SMONTHOUSANDSEP
LOCALE_INEGCURR
LOCALE_SNEGATIVESIGN
LOCALE_INEGNUMBER
LOCALE_SPOSITIVESIGN
LOCALE_ITIME
LOCALE_SSHORTDATE
LOCALE_S1159
LOCALE_STHOUSAND
LOCALE_S2359
LOCALE_STIME
LOCALE_SCURRENCY
LOCALE_STIMEFORMAT


//Usage:
SetLocaleInfo(GetSystemDefaultLCID, LOCALE_SDATE, '.');

//SetLocalInfo changes your whole computers settings.
To change setting for application only try:

SysUtils.DateSeparator := '.' ;

These are the SysUtils constants:
Delphi-Quellcode:
CurrencyString: string;
CurrencyFormat: Byte;
NegCurrFormat: Byte;
ThousandSeparator: Char;
DecimalSeparator: Char;
CurrencyDecimals: Byte;
DateSeparator: Char;
ShortDateFormat: string;
LongDateFormat: string;
TimeSeparator: Char;
TimeAMString: string;
TimePMString: string;
ShortTimeFormat: string;
LongTimeFormat: string;
ShortMonthNames: array[1..12] of string;
LongMonthNames: array[1..12] of string;
ShortDayNames: array[1..7] of string;
LongDayNames: array[1..7] of string;
SysLocale: TSysLocale;
EraNames: array[1..7] of string;
EraYearOffsets: array[1..7] of Integer;
TwoDigitYearCenturyWindow: Word = 50;
ListSeparator: Char;
oder:

Regional Settings (INTL.CPL)
---------------------------------
Regional Settings Properties (Regional Settings):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,0
Regional Settings Properties (Number):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,1
Regional Settings Properties (Currency):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,2
Regional Settings Properties (Time):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,3
Regional Settings Properties (Date):
rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,4

You can call the Region Options Applet:
{This will open the Currency Tab of the Region Options Applet}
Delphi-Quellcode:
ShellExecute(Handle,
PChar('open'),
PChar('rundll32.exe'),
PChar( 'shell32.dll,
Control_RunDLL
intl.cpl,,2
'),
nil,
SW_NORMAL);

Geändert von hathor ( 8. Nov 2013 um 16:27 Uhr)
  Mit Zitat antworten Zitat