10-10-2008, 07:43 PM
Quick question
Shouldn't the AddInt and AddLong be like this:
Otherwise:
You'd be overwriting anything you've written to the Buffer() before that call because it's setting Buffer = tBytes. tBytes is never given the data from Buffer.
Shouldn't the AddInt and AddLong be like this:
Code:
Public Sub AddIntegerToSetBuffer(ByRef Buffer() As Byte, vData As Integer, ByRef WriteHead As Integer)
Call CopyMemory(Buffer(WriteHead), vData, 2)
WriteHead = WriteHead + 2
End Sub
Code:
Public Sub AddLongToSetBuffer(ByRef Buffer() As Byte, vData As Long, ByRef WriteHead As Integer)
Call CopyMemory(Buffer(WriteHead), vData, 4)
WriteHead = WriteHead + 4
End Sub
Otherwise:
Code:
Public Sub AddIntegerToSetBuffer(ByRef Buffer() As Byte, vData As Integer, ByRef WriteHead As Integer)
Dim tBytes() As Byte
ReDim tBytes(UBound(Buffer))
Call CopyMemory(tBytes(WriteHead), vData, 2)
Buffer = tBytes
WriteHead = WriteHead + 2
End Sub
You'd be overwriting anything you've written to the Buffer() before that call because it's setting Buffer = tBytes. tBytes is never given the data from Buffer.