Thema: C++ GUID Format wandeln

Einzelnen Beitrag anzeigen

Benutzerbild von KodeZwerg
KodeZwerg

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

AW: GUID Format wandeln

  Alt 15. Apr 2021, 22:45
Delphi-Quellcode:
uses
  System.SysUtils;
const
  guid: TGuid = (D1: $A26078C5; D2: $2840; D3: $4726; D4: ($B4, $27, $E6, $0F, $C8, $FE, $E4, $03));
begin
  Writeln(guid.ToString);
end.
Kannte ich so auch noch nicht, ist ja viel kürzer als meins hier:
Delphi-Quellcode:
program Project15;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils, System.Win.ComObj;

var
  vGUID: TGUID;
begin
  try
    vGUID.D1 := LongWord($A26078C5);
    vGUID.D2 := Word($2840);
    vGUID.D3 := Word($4726);
    vGUID.D4[0] := Byte($B4);
    vGUID.D4[1] := Byte($27);
    vGUID.D4[2] := Byte($E6);
    vGUID.D4[3] := Byte($0F);
    vGUID.D4[4] := Byte($C8);
    vGUID.D4[5] := Byte($FE);
    vGUID.D4[6] := Byte($E4);
    vGUID.D4[7] := Byte($03);
    WriteLn(GUIDToString(vGUID));
    ReadLn;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
Gruß vom KodeZwerg

Geändert von KodeZwerg (15. Apr 2021 um 22:51 Uhr) Grund: bug
  Mit Zitat antworten Zitat