views:

112

answers:

2

Hi,

Is any other way to compare 2 TGUID elements, except transform them into strings (the guidtostring function) and after evaluate the expression, in Delphi 7?

Best regards,

+14  A: 

You can use IsEqualGUID API declared in SysUtils.

TOndrej
thank you +1, best regards
Radu Barbu
+2  A: 

IsEqualGUID() (or IsEqualIID()), like TOndrej suggested. You can also use SysUtuils. CompareMem() instead, since TGuid is a binary array of bytes.

Remy Lebeau - TeamB
As a side note: A GUID is NOT an array of bytes, it is a packed structure with DWORDS, WORDS and BYTES with a total length of 16 bytes. You can lookup the structure by checking out the TGUID type.
Ritsaert Hornstra
My point was that it is a fixed-length binary data type without any padding, so CompareMem() will work as an alternative to IsEqualGUID(), ie: `CompareMem(@Guid1, @Guid2, SizeOf(TGuid))`.
Remy Lebeau - TeamB