uses ComObj, ActiveX;

procedure TForm1.Button1Click(Sender: TObject);
var
  Guid: TGUID;
  str: string;
begin
  CoCreateGuid(Guid);
  str := GUIDToString(Guid);

  Memo1.Lines.Add(str);
end;

procedure TForm1.Button2Click(Sender: TObject);
const
  Guid: TGUID = (D1:$AAAAAAAA; D2:$BBBB; D3:$CCCC; D4:($11,$22,$33,$44,$55,$66,$77,$88));
var
  str: string;
begin
  str := GUIDToString(Guid);
  ShowMessage(str); {AAAAAAAA-BBBB-CCCC-1122-334455667788}
end;

procedure TForm1.Button3Click(Sender: TObject);
const
  Guid: TGUID = '{AAAAAAAA-BBBB-CCCC-1122-334455667788}';
var
  str: string;
begin
  str := GUIDToString(Guid);
  ShowMessage(str); {AAAAAAAA-BBBB-CCCC-1122-334455667788}
end;

posted on 2008-12-11 17:25  万一  阅读(7119)  评论(7编辑  收藏  举报