Mega Code Archive

 
Categories / Delphi / Ide Indy
 

Create a GUID at runtime

Title: create a GUID at runtime? uses ComObj, ActiveX; function CreateGuid: string; var ID: TGUID; begin Result := ''; if CoCreateGuid(ID) = S_OK then Result := GUIDToString(ID); end; procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Text := CreateGuid; // or: Edit1.Text := CreateClassID end;