Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Unique Number Identifyer


Message #1 by "Sam Johnston" <sam.johnston@j...> on Fri, 26 Jul 2002 10:34:27 -0400
How about using GUID's ?? microsoft claims there are truly unique...
see if this works for you...

satya


-- start code block

Private Declare Function CoCreateGuid Lib "OLE32.DLL" _
    (pGUID As GUID) As Long

Private Declare Function StringFromGUID2 Lib "OLE32.DLL" _
    (pGUID As GUID, _
     ByVal PointerToString As Long, _
     ByVal MaxLength As Long) As Long

Private Type GUID
    Guid1 As Long
    Guid2 As Long
    Guid3 As Long
    Guid4(0 To 7) As Byte
End Type

Public Function CreateGUID() As String

    Dim udtGUID As GUID
    Dim sGUID As String
    Dim lResult As Long

    lResult = CoCreateGuid(udtGUID)

    If lResult Then
        sGUID = ""
    Else
        sGUID = String$(38, 0)
        StringFromGUID2 udtGUID, StrPtr(sGUID), 39
    End If

    CreateGUID = sGUID

End Function   
 '--end code block


----- Original Message ----- 
From: "Sam Johnston" <sam.johnston@j...>
To: "professional vb" <pro_vb@p...>
Sent: Friday, July 26, 2002 8:04 PM
Subject: [pro_vb] Unique Number Identifyer


> Is there a function that I can use to obtain a Julian date (such as
> number of days transpired since Jan 01, 1970)? and then get the
> equivalent in time (such as seconds since midnight)?  I am building an
> event tracker and need to have some sort of unique ID for each event.
> By using Julian Date / Time then combining it with some unique event
> type ID, I think it will do the trick.  Any thoughts?
>  
> Sam
>  
> 
> 
> 
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills 
> from Visual Basic 6 to C#, the language of choice 
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
> 
> 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.361 / Virus Database: 199 - Release Date: 07/05/2002

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com

  Return to Index