Den*_*lik 3 delphi uuid guid delphi-5
有没有一种方法可以在Delphi 5中生成GUID v1(基于时间)?我发现了这个功能...
unit ComObj;
function CreateClassID: string;
Run Code Online (Sandbox Code Playgroud)
但是我不确定它是否生成基于时间的GUID。我也知道这一点...
SysUtils.CreateGUID(newGUID);
Run Code Online (Sandbox Code Playgroud)
...,它调用CoCreateGUID产生GUID版本4(随机)的Windows API 。
与实现CreateGUID的方式类似-使用UuidCreateSequential:
uses
Windows;
function UuidCreateSequential(out guid: TGUID): Longint; stdcall; external 'rpcrt4.dll' name 'UuidCreateSequential';
function CreateGUID_V1(out Guid: TGUID): HResult;
begin
Result := HResultFromWin32(UuidCreateSequential(Guid));
end;
Run Code Online (Sandbox Code Playgroud)
我这里没有Delphi 5,所以不确定这里使用的所有功能是否都可以在20年前使用。