Name

TGUID Type

Syntax

type
  TGUID = packed record
    D1: LongWord;
    D2: Word;
    D3: Word;
    D4: array[0..7] of Byte;
  end;

Description

The TGUID type stores a Globally Unique Identifier (GUID). When Windows generates a new GUID, it guarantees that the GUID is unique among all the GUIDs generated throughout the world. Delphi uses GUIDs to identify and look up interfaces.

Tips and Tricks

  • Delphi automatically casts an interface name to its GUID, so you can use the interface name in calls to QueryInterface, for example.

  • In an interface declaration, write a GUID in square brackets, e.g.:

type IUnknown = interface
  ['{00000000-0000-0000-C000-000000000046}']
  • To generate a new GUID in the IDE, press Ctrl-Shift-G.

  • GUIDs are optional in interface declarations, but you usually need them. Without a GUID, you cannot cast an interface to another type.

See Also

Interface Keyword, IUnknown Interface, PGUID Type
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset