Unit 'sysutils' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]


Create a new GUID.


Source position: sysutilh.inc line 262

function CreateGUID(

  out GUID: TGuid



CreateGUID can be called to create a new GUID (Globally Unique Identifier) value. The function returns the new GUID value in GUID and returns zero in case the GUID was created successfully. If no GUID was created, a nonzero error code is returned.

The default mechanism for creating a new GUID is system dependent. If operating system support is available, it is used. If none is available, a default implementation using random numbers is used.

The OnCreateGUID callback can be set to hook a custom mechanism behind the CreateGUID function. This can be used to let the GUID be created by an external GUID creation library.


On error, a nonzero return value is returned.

See also



Return the index of a GUID in an array of GUID values.



Check whether two TGUID variables are equal.



Convert a string to a native TGUID type.



Try to transform a string to a GUID.



Convert a TGUID to a string representation.

Documentation generated on: Jul 24 2023