GUID.pas 736 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. unit GUID;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ActiveX;
  6. type
  7. TfrmGUID = class(TForm)
  8. txtGUID: TEdit;
  9. btnClose: TButton;
  10. btnGenerate: TButton;
  11. procedure btnGenerateClick(Sender: TObject);
  12. procedure FormShow(Sender: TObject);
  13. private
  14. { Private declarations }
  15. public
  16. { Public declarations }
  17. end;
  18. var
  19. frmGUID: TfrmGUID;
  20. implementation
  21. {$R *.dfm}
  22. procedure TfrmGUID.btnGenerateClick(Sender: TObject);
  23. var
  24. pGUID: TGUID;
  25. begin
  26. CoCreateGUID(pGUID);
  27. txtGUID.Text := GUIDToString(pGUID);
  28. txtGUID.SetFocus;
  29. end;
  30. procedure TfrmGUID.FormShow(Sender: TObject);
  31. begin
  32. btnGenerate.Click;
  33. txtGUID.SetFocus;
  34. end;
  35. end.