TGUID Type
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.
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.