Einzelnen Beitrag anzeigen

Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#21

AW: Datumsformat (TT.MM.JJJJ) anzeigen

  Alt 8. Jun 2018, 13:02
Danke TiGü, ich habe es jetzt so umgesetzt
Delphi-Quellcode:
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: Integer;
  DataValue: array of WideChar;
begin
  lpLocaleName := PChar(LOCALE_NAME_SYSTEM_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;
  ShowMessage(string(DataValue));
end;

procedure TForm1.FormCreate(Sender: TObject);
Begin
 DoJob();
End;
Ein Kompilat kann ich erzeugen aber der sagt dann immer "Unzulässige Attribute". Was mache ich noch falsch?
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat