2008. augusztus 24., vasárnap
Create a GUID at runtime
Problem/Question/Abstract:
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:
function CoCreateGuid(pGUID: TGUID): longint; external 'OLE32.DLL';
procedure TForm1.FormCreate(Sender: TObject);
var
udtGUID: TGUID;
lResult: longint;
begin
lResult := CoCreateGuid(udtGUID);
// see definition of TGUID in Delphi's online help
// udtGUID.D4 = network card's number
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése