View Single Post
  #2 (permalink)  
Old February 25th, 2002
Joetella Joetella is offline
Disciple
 
Join Date: January 3rd, 2002
Location: USA,Connecticut
Posts: 12
Joetella is flying high
Default Re: I'm stuck need help

Quote:
Originally posted by abhiexx
Hi !
i am a novice programmer......trying to code a gnutella clone for my class project..
I am facing trouble with using the GUID in the header....
My problem is :-

a) As the cocreateguid function returns a GUID structure....how do i convert that into a byte array sos that i can send it on it's way....the UUidtostring ()
function is not working for me.....is causing an exception in the application code.

b)Could anyone also please...clarify the purpose the GUID serves and how do i hanlde it in my application.....


----Thanks help will be highly appreciated....
Here is my Guid Code, a function which return a Byte array ..
note that you dont need to use CoCreateguid function!

Code:
Private Function Guid() As Byte()
    
   On Error GoTo HandleError
   
   Dim iPos As Integer
   Dim bTemp() As Byte
   ReDim bTemp(0 To 15)

' client guid
   Randomize
   For iPos = 0 To 14
      bTemp(iPos) = CByte((254 * Rnd + 1))
   Next iPos
   bTemp(7) = 255
   bTemp(15) = 0
   Guid = bTemp
   Exit Function
   
HandleError:
   LogError ("Guid")
   Resume Next
    
End Function
Reply With Quote