![]() |
AW: Geolocation Windows API
Zitat:
Delphi-Quellcode:
function ToIID(A: Cardinal; B, C: Word; D, E, F, G, H, I, J, K: Byte): string;
begin Result := '{' + IntToHex(A) + '-' + IntToHex(B) + '-' + IntToHex(C) + '-' + IntToHex(D) + IntToHex(E) + '-' + IntToHex(F) + IntToHex(G) + IntToHex(H) + IntToHex(I) + IntToHex(J) + IntToHex(K) + '}'; end; var s: string; begin s := ToIID(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113); ShowMessage(s); end; |
AW: Geolocation Windows API
ID.ToString
![]() Zitat:
Ich weiß jetzt nicht, wie es bei dieser Komponente aussieht, aber viele neue Komponenten, im Delphi, greifen intern auf die API der UWP zu, auch wenn du für Win32 (32 oder 64 Bit) kompiliert hast. Wenn ich mich recht erinnere, z.B. bei den Bluetooth-Komponenten. Zitat:
|
AW: Geolocation Windows API
Zitat:
|
AW: Geolocation Windows API
|
AW: Geolocation Windows API
Zitat:
|
AW: Geolocation Windows API
Delphi-Quellcode:
var guid : TGUID;
guid.D1 := 4082257043; guid.D2 := 58823; guid.D3 := 23432; guid.D4[0] := 190; guid.D4[1] := 219; guid.D4[2] := 211; guid.D4[3] := 230; guid.D4[4] := 55; guid.D4[5] := 207; guid.D4[6] := 242; guid.D4[7] := 113; ShowMessage(guid.tostring); |
AW: Geolocation Windows API
Oder ein TGUID.Create mit den binären Daten.
k.A. warum es keine Variante mit den Feld-Parametern gibt oder der String-Variante. wobei der Compiler den String
Delphi-Quellcode:
kennt und man es dort einfach mit
'{...}'
Delphi-Quellcode:
machen kann.
:=
|
AW: Geolocation Windows API
Danke für die Einweisung @SheBang, das funzt :-D
Zitat:
|
AW: Geolocation Windows API
Zitat:
Nur Spaß, mit ein-zwei Zeilen bist du dabei (siehe auch vorige Antworten):
Delphi-Quellcode:
program Project1;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils; var IID: TGUID; begin try IID := TGUID.Create(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113); Writeln(IID.ToString) except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; Readln; end. Das verwendet dann den TGUIDHelper aus System.SysUtils (nein, ich weiß nicht seit wann das drin ist, bitte fragt nicht):
Delphi-Quellcode:
class function TGUIDHelper.Create(A: Cardinal; B, C: Word; D, E, F, G, H, I, J, K: Byte): TGUID;
begin Result.D1 := UInt32(A); Result.D2 := Word(B); Result.D3 := Word(C); Result.D4[0] := D; Result.D4[1] := E; Result.D4[2] := F; Result.D4[3] := G; Result.D4[4] := H; Result.D4[5] := I; Result.D4[6] := J; Result.D4[7] := K; end; |
AW: Geolocation Windows API
Delphi-Quellcode:
procedure guidtest(guid: TGUID);
begin end; const myguid: TGUID = '{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'; // hier geht es, unten nicht :( procedure TForm21.FormCreate(Sender: TObject); var guid: TGUID; bytes: TBytes; begin guid := TGUID.Create('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'); //guid := '{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'; guid := myguid; // komisch da geht es, warum nicht auch das davor? //guidtest('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}'); geht auch nicht guidtest(TGUID.Create('{F3524C93-E5C7-5B88-BEDB-D3E637CFF271}')); // den hatte ich auf die Schnelle übersehn .. dachte ihn gibt es (noch) nicht guid := TGUID.Create(4082257043, 58823, 23432, 190, 219, 211, 230, 55, 207, 242, 113); // mit der ByteOrder bin ich mir grade nicht sicher ... kann sein (wird aber bestimmt so sein), das man die ersten LongWord/Word umdrehen muß. bytes := [243, 82, 76, 147, {} 229, 199, {} 91, 136, {} 190, 219, 211, 230, 55, 207, 242, 113]; guid := TGUID.Create(bytes); // als Array guid := TGUID.Create(bytes[0]); // als "irgendwelche" binäre Daten (Zeiger) -> TGUIDHelper.Create(const Data; DataEndian: TEndian=TEndian.Little) end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:55 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz