DelphiFAQ Home Search:

Create a GUID at runtime

 

comments1 comments. Current rating: 4 stars (1 votes). Leave comments and/ or rate it.

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;

Comments:

2008-10-28, 06:55:18
anonymous from United Kingdom  
rating

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Los Angeles, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.