DelphiFAQ Home Search:
General :: Windows :: Programming :: Windows with Delphi :: Windows API
Windows programming with Delphi

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Only the 40 most recently viewed articles are shown.
You can see the full list here.

Featured Article

Create a GUID at runtime

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;
 

Generated 4:02:42 on Jun 20, 2018