[icq-devel] vb

Jason Dodson webmaster at mindchild.net
Sun Jun 9 06:53:15 CEST 2002

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

Public Sub ReverseBytesLong(ByRef MyLong As Long)

    Dim buf(4) As Byte
    Dim TempByte As Byte
    CopyMemory buf(0), MyLong, 4
    TempByte     buf(0)     buf(3) 
    TempByte     buf(1)     buf(2) 
    CopyMemory MyLong, buf(0), 4

End Sub

  ----- Original Message ----- 
  From: Göran Roseen 
  To: icq-devel at blipp.com 
  Sent: Wednesday, June 05, 2002 4:33 AM
  Subject: Re: [icq-devel] vb

  It is really simple to code, the problem is that VB does not have any unsigned data types, and so you might have problems with the sign bit ending up where you don't want it.

  I don't know how you get your packet data inte the program but my advice is: swap while you still have the data in a char buffer. The unpacking routines would be a simple choice. I.e. use different unpacking routines for the different byte-ordered data.

  Another tip is to use larger data types (E.g. Long instead of Integer) when the data has to be unsigned. That way, large numbers will never appear negative.


  At 04:48 2002-06-05, you wrote:

    hey guys ,
    i'm Developing a ICQ clone in VB and i'm having some problems with it ,
    does anyone have functions for Reverse Byte Order in VB 
    ( for making Big Endian , Little Endian , etc.. )
    Thanks !!
                   z e l t z m a n.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://vic20.blipp.com/pipermail/icq-devel/attachments/20020609/70788140/attachment.htm 

More information about the icq-devel mailing list