How to use COCreateGuid and StringFromGuid ,Thanks first !

neco 2001-10-15 02:46:50
I had written this funtion ,but I don't where are the CoCreateGuid and
StringFromGuid decalred and how to use it ?
Please help me ,thanks first !
//////////////////////////////////////////////////////////////////////////
Function GetUniqueId: String;
Var
Tmp: pWideChar;
Guid: TGuid;
Begin
Result := '';
Tmp := AllocMem( 160 );
Try
CoCreateGuid( Guid );
Guid.D4[ 0 ] := Round( random * 255 );
Guid.D4[ 1 ] := Round( random * 255 );
Guid.D4[ 2 ] := Round( random * 255 );
Guid.D4[ 3 ] := Round( random * 255 );
Guid.D4[ 4 ] := Round( random * 255 );
Guid.D4[ 5 ] := Round( random * 255 );
Guid.D4[ 6 ] := Round( random * 255 );
Guid.D4[ 7 ] := Round( random * 255 );
StringFromGuid2( Guid, Tmp, 40 );
Result := copy( Tmp, 2, length( Tmp ) - 2 );
Finally
FreeMem( Tmp );
End;
End;



...全文
60 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
newyj 2001-10-15
  • 打赏
  • 举报
回复
uses activex

5,931

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧