Skip to content

Instantly share code, notes, and snippets.

@esasse
Created August 28, 2012 12:22
Show Gist options
  • Save esasse/3497615 to your computer and use it in GitHub Desktop.
Save esasse/3497615 to your computer and use it in GitHub Desktop.
Function to generate UUID32 in Delphi
function NewUUID32: string;
var
GUID: TGUID;
begin
CoCreateGuid(GUID);
SetLength(Result, 32);
StrLFmt(PChar(Result), 32,'%.8x%.4x%.4x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x',
[Guid.D1, Guid.D2, Guid.D3, Guid.D4[0], Guid.D4[1], Guid.D4[2], Guid.D4[3],
Guid.D4[4], Guid.D4[5], Guid.D4[6], Guid.D4[7]]);
end;
@magnomp
Copy link

magnomp commented Aug 29, 2012

Para a conversão para String, chegou a olhar a função GUIDToStr()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment