本文整理自网络,侵删。
Uses ActiveX;
//随机英文数字 dInt 长度 1-32function Rand(dInt: Integer):string;var I: Integer; sGUID : string; TmpGUID: TGUID;begin for I := 0 to 10 do begin if CoCreateGUID(TmpGUID) = S_OK then begin sGUID := GUIDToString(TmpGUID); sGUID := Copy(StringReplace(sGUID, '-', '', [rfReplaceAll, rfIgnoreCase]), 2, dInt); end else ShowMessage('Create GUID error!'); // ShowMessage(sGUID); end;
Result:=sGUID;end;
//调用方法procedure TForm1.Button1Click(Sender: TObject);beginshowmessage(Rand(32));end;
相关阅读 >>
如何用Delphi实现windows xp中“本地连接”的启用和禁用
Delphi twebbrowser 响应回车键(ewb响应正常,无需额外代码)
Delphi 系统对话框(如浏览目录)被隐藏到主窗体后面造成程序无法操作的临时处理方式
更多相关阅读请进入《Delphi》频道 >>