Created
August 28, 2012 12:22
-
-
Save esasse/3497615 to your computer and use it in GitHub Desktop.
Function to generate UUID32 in Delphi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para a conversão para String, chegou a olhar a função GUIDToStr()?