Author: Tomas Rutkauskas
Create a GUID at runtime
Answer:
You may need to create a GUID at runtime. One reason could be to simply have a
unique number that identifies each workstation.By the way the last group of digits
in the GUID generated on a computer is its network card number (if any is present).
Delphi does not have the needed definitions, here they are:
1 2 function CoCreateGuid(pGUID: TGUID): longint; external 'OLE32.DLL';
3 4 procedure TForm1.FormCreate(Sender: TObject);
5 var6 udtGUID: TGUID;
7 lResult: longint;
8 begin9 lResult := CoCreateGuid(udtGUID);
10 // see definition of TGUID in Delphi's online help11 // udtGUID.D4 = network card's number12 end;