Hi

Looking on this forum, I guess this is how it should look like... but its not working:
Public fileprocs As BASS_FILEPROCS
Public stream As Long
Public data() As Byte
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal length As Long)
stream = BASS_StreamCreateFileUser(STREAMFILE_BUFFERPUSH, 0, VarPtr(fileprocs), 0) ' create the stream
' callback table
Public Sub createFileProcs()
With fileprocs
.close = getAddressOf(AddressOf FILECLOSEPROC_)
.length = getAddressOf(AddressOf FILELENPROC_)
.read = getAddressOf(AddressOf FILEREADPROC_)
.seek = 0
End With
End Sub
Public Function getAddressOf(ByVal func As Long) As Long
getAddressOf = func
End Function
' User file stream callback functions (BASS_FILEPROCS)
Sub FILECLOSEPROC_(ByVal user As Long)
End Sub
Function FILELENPROC_(ByVal user As Long) As Currency ' ???
FILELENPROC_ = 0 ' indeterminate length
End Function
' not sure how to do it
Function FILEREADPROC_(ByVal buffer As Long, ByVal length As Long, ByVal user As Long) As Long
'Call CopyMemory(ByVal buffer, data(0), UBound(data))
FILEREADPROC_ = UBound(data)
End Function
Public Sub downloadData(ByVal bytesTotal As Long)
If (bytesTotal <= 0) Then Exit Sub
ReDim data(bytesTotal) As Byte
Winsock.GetData data(), vbByte, bytesTotal
' feed data to stream
If (BASS_StreamPutFileData(stream, data(0), bytesTotal) = -1) Then Exit Sub
End Sub
Public Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Call downloadData(bytesTotal)
End Sub