program Guid; {$APPTYPE CONSOLE} uses SysUtils; var Uid: TGuid; Result: HResult; begin Result := CreateGuid(Uid); if Result = S_OK then WriteLn(GuidToString(Uid)); end.
下面的CreateGuid()调用Windows API函数CoCreateGuid()。