vb6生成GUID

前端之家收集整理的这篇文章主要介绍了vb6生成GUID前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
PrivateDeclareFunctionCoCreateGuidLib"ole32"(idAsAny)AsLong PrivateSubForm_Load() MsgBox"GeneratedGUID:"+CreateGUID EndSub PublicFunctionCreateGUID()AsString Dimid(0To15)AsByte DimCntAsLong,GUIDAsString IfCoCreateGuid(id(0))=0Then ForCnt=0To15 CreateGUID=CreateGUID+IIf(id(Cnt)<16,"0","")+Hex$(id(Cnt)) NextCnt CreateGUID=Left$(CreateGUID,8)+"-"+Mid$(CreateGUID,9,4)+"-"+Mid$(CreateGUID,13,17,4)+"-"+Right$(CreateGUID,12) Else MsgBox"ErrorwhilecreatingGUID!" EndIf EndFunction

猜你在找的VB相关文章