如何在Inno安装程序中生成新的GUID?
发布时间:2020-12-15 04:30:52 所属栏目:大数据 来源:网络整理
导读:有没有办法从Inno安装脚本内部生成新的GUID? 解决方法 在innosetup新闻组存档中找到这个: http://news.jrsoftware.org/news/innosetup/msg76234.html 我没有测试过. [Code]type TGUID = record D1: LongWord; D2: Word; D3: Word; D4: array[0..7] of Byte
有没有办法从Inno安装脚本内部生成新的GUID?
解决方法
在innosetup新闻组存档中找到这个:
http://news.jrsoftware.org/news/innosetup/msg76234.html 我没有测试过. [Code] type TGUID = record D1: LongWord; D2: Word; D3: Word; D4: array[0..7] of Byte; end; function CoCreateGuid(var Guid:TGuid):integer; external 'CoCreateGuid@ole32.dll stdcall'; function inttohex(l:longword; digits:integer):string; var hexchars:string; begin hexchars:='0123456789ABCDEF'; setlength(result,digits); while (digits>0) do begin result[digits]:=hexchars[l mod 16+1]; l:=l div 16; digits:=digits-1; end; end; function GetGuid(dummy:string):string; var Guid:TGuid; begin if CoCreateGuid(Guid)=0 then begin result:='{'+IntToHex(Guid.D1,8)+'-'+ IntToHex(Guid.D2,4)+'-'+ IntToHex(Guid.D3,4)+'-'+ IntToHex(Guid.D4[0],2)+IntToHex(Guid.D4[1],2)+'-'+ IntToHex(Guid.D4[2],2)+IntToHex(Guid.D4[3],2)+ IntToHex(Guid.D4[4],2)+IntToHex(Guid.D4[5],2)+ IntToHex(Guid.D4[6],2)+IntToHex(Guid.D4[7],2)+ '}'; end else result:='{00000000-0000-0000-0000-000000000000}'; end; function InitializeSetup(): Boolean; begin MsgBox(GetGuid(''),mbInformation,MB_OK); Result := False; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |