zoukankan      html  css  js  c++  java
  • VB6生成GUID

    ### 1.声名win api
    Private Declare Function CoCreateGuid Lib "OLE32" (pGuid As guid) As Long

    ### 2.定义Type
    Private Type guid
        Data1 As Long
        Data2 As Integer
        Data3 As Integer
        Data4(7) As Byte
    End Type

    ### 3.生成GUID

    Public Function GetGUID() As String
        Dim udtGUID As guid

        If (CoCreateGuid(udtGUID) = 0) Then
            GetGUID = _
                    String(8 - Len(Hex$(udtGUID.Data1)), "0") & Hex$(udtGUID.Data1) & _
                    String(4 - Len(Hex$(udtGUID.Data2)), "0") & Hex$(udtGUID.Data2) & _
                    String(4 - Len(Hex$(udtGUID.Data3)), "0") & Hex$(udtGUID.Data3) & _
                    IIf((udtGUID.Data4(0) < &H10), "0", "") & Hex$(udtGUID.Data4(0)) & _
                    IIf((udtGUID.Data4(1) < &H10), "0", "") & Hex$(udtGUID.Data4(1)) & _
                    IIf((udtGUID.Data4(2) < &H10), "0", "") & Hex$(udtGUID.Data4(2)) & _
                    IIf((udtGUID.Data4(3) < &H10), "0", "") & Hex$(udtGUID.Data4(3)) & _
                    IIf((udtGUID.Data4(4) < &H10), "0", "") & Hex$(udtGUID.Data4(4)) & _
                    IIf((udtGUID.Data4(5) < &H10), "0", "") & Hex$(udtGUID.Data4(5)) & _
                    IIf((udtGUID.Data4(6) < &H10), "0", "") & Hex$(udtGUID.Data4(6)) & _
                    IIf((udtGUID.Data4(7) < &H10), "0", "") & Hex$(udtGUID.Data4(7))
        End If
    End Function

  • 相关阅读:
    pycharm破解补丁的使用
    C# 解析JSON格式数据
    LINQ to DataSet的DataTable操作
    日期格式化
    vue scoped原理
    vue父子组件生命周期执行顺序
    js判断同一天和同一周
    flex总结
    react-router v4 参数传递
    link标签rel="alternate"属性的作用及用法
  • 原文地址:https://www.cnblogs.com/lost0/p/15019162.html
Copyright © 2011-2022 走看看