" Jerry Camel" < RL ***** @ msn.com>写在 新闻:eM ************* @ tk2msftngp13.phx.gbl:"Jerry Camel" <rl*****@msn.com> wrote innews:eM*************@tk2msftngp13.phx.gbl:我需要能够生成文件的唯一名称。 I need to be able to generate unique names for files. 使用GUID。它们保证是独一无二的,而且它们是神秘的。生成GUID的最简单方法是从$ / b $ b请求WinAPI中的一个: --clip-- 私有类型GUID Data1 As Long Data2 As Integer Data3 As Integer Data4(7)As Byte 结束类型 私有声明功能CoCreateGuid Lib" OLE32.DLL" _ (pGuid作为GUID)长期 私函数GetGUID()字符串 Dim udtGUID作为GUID 如果(CoCreateGuid(udtGUID)= 0)那么 GetGUID = _ 字符串(8 - Len(HexUse GUIDs. They are guaranteed to be unique, and theyare cryptic. Easiest way to generate a GUID is toask for one from WinAPI:--clip--Private Type GUIDData1 As LongData2 As IntegerData3 As IntegerData4(7) As ByteEnd TypePrivate Declare Function CoCreateGuid Lib "OLE32.DLL" _(pGuid As GUID) As LongPrivate Function GetGUID() As StringDim udtGUID As GUIDIf (CoCreateGuid(udtGUID) = 0) ThenGetGUID = _String(8 - Len(Hex 这篇关于唯一名称生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-29 16:05