Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
9. Jun 2018
Tut mir leid, mein Fehler, ich brachte Deinen Text mit diesen Ergebnissen durcheinander.
function LCIDToLocaleName(Locale: LCID; lpName: LPWSTR; cchName: Integer; dwFlags: DWORD): Integer; stdcall; external kernel32 name 'LCIDToLocaleName';
function LCIDToLocal ( LCID: Integer ) : String;
var
strNameBuffer : array of WideChar;
begin
Result := '';
if (LCIDToLocaleName(LCID,...
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
function GetLocaleString(LangID: Integer): string;
var
s: string;
begin
Result := '';
SetLength(s, 128);
if GetLocaleInfo(LangID, LOCALE_SNATIVELANGNAME, PChar(s), 128) > 0 then
begin
Result := StrPas(PChar(s));
if GetLocaleInfo(LangID, LOCALE_SNATIVECTRYNAME, PChar(s), 128) > 0 then
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
function GLI(T: Cardinal): String;
var
NeedLen : Integer;
begin
NeedLen := GetLocaleInfo(LOCALE_USER_DEFAULT, t, nil, 0);
SetLength(Result, NeedLen);
if GetLocaleInfo(
LOCALE_USER_DEFAULT, t, PChar(Result), NeedLen) <> 0
then SetLength(Result, NeedLen-1)
else RaiseLastOSError;
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
So klappt es, vielen Dank!
Hier nochmal für HolgerX wegen fehlender Konstanten zum nachvollziehen:
function GetLocaleInfoEx(lpLocaleName: PWideChar; LCType: LCTYPE; lpLCData: PWideChar; cchData: Integer): Integer; stdcall; external kernel32 name 'GetLocaleInfoEx';
procedure DoJob;
const
LOCALE_NAME_SYSTEM_DEFAULT = '!x-sys-default-locale'; // <- das bringt bei mir einen Leerstring
...
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
Danke fürs korrigieren aber ich erhalte dabei einen leeren String.
Mein Delphi und ich machen da noch irgendwas falsch.
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
Danke TiGü, ich habe es jetzt so umgesetzt
function GetLocaleInfoEx(const lpLocaleName: LPCWSTR; const LCType: LCTYPE; out lpLCData: LPWSTR; const cchData: integer): Integer; external kernel32 name 'GetLocaleInfoEx';
procedure DoJob;
const
LOCALE_NAME_SYSTEM_DEFAULT = '!x-sys-default-locale';
var
lpLocaleName: PWideChar; LLCType: LCTYPE;
lpLCData: PWideChar; cchData, ReturnValue:...
Forum: Win32/Win64 API (native code)
Delphi
by KodeZwerg,
8. Jun 2018
Oder meintest Du es so?
var
FmtSet: TFormatSettings;
tmp: String;
i: Integer;
begin
GetLocaleFormatSettings(LOCALE_USER_DEFAULT, FmtSet);
ShowMessage(FmtSet.ShortDateFormat);
GetLocaleFormatSettings(LOCALE_SYSTEM_DEFAULT, FmtSet);