Delphi UUID generator

前端 未结 4 1897
野的像风
野的像风 2021-02-05 00:28

Does Delphi have anything built-in to generate UUIDs?

4条回答
  •  借酒劲吻你
    2021-02-05 01:02

    program Guid;
    
    {$APPTYPE CONSOLE}
    
    uses
    SysUtils;
    
    var
    
    Uid: TGuid;
    Result: HResult;
    
    begin
    Result := CreateGuid(Uid);
    if Result = S_OK then
       WriteLn(GuidToString(Uid));
    end.
    

    Under the covers CreateGuid() calls one of the various APIs, depending on the platform. For example on Windows, it nowadays calls UuidCreate.

提交回复
热议问题