Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.060 Beiträge
 
Delphi 10.4 Sydney
 
#24

AW: Datumsformat (TT.MM.JJJJ) anzeigen

  Alt 8. Jun 2018, 13:46
Delphi-Quellcode:
function GetLocaleInfoEx(lpLocaleName: PWideChar; LCType: LCTYPE;
  lpLCData: PWideChar; cchData: Integer): Integer; stdcall; external kernel32 name 'GetLocaleInfoEx';
...
var
  lpLocaleName: PWideChar; LLCType: LCTYPE;
  lpLCData: PWideChar; cchData, ReturnValue: Integer;
  DataValue: array of WideChar;
  DataString: string;
begin
  lpLocaleName := PChar(LOCALE_NAME_USER_DEFAULT);
  LLCType := LOCALE_SSHORTDATE;
  lpLCData := nil;
  cchData := 0;
  cchData := GetLocaleInfoEx(lpLocaleName, LLCType, lpLCData, cchData);

  if cchData = 0 then
    RaiseLastOSError
  else
  begin
    SetLength(DataValue, cchData);
    lpLCData := @DataValue[0];
    cchData := GetLocaleInfoEx(lpLocaleName, LLCType, lpLCData, cchData);
  end;
  SetString(DataString, PChar(@DataValue[0]), Length(DataValue));
  ShowMessage(DataString);
end;
  Mit Zitat antworten Zitat