20 May '13 - 00:26 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Need example Bass_StreamCreateFileUser & Winsock vb6  (Read 1748 times)
shuttle
Posts: 70


« on: 21 Aug '08 - 16:59 »
Reply with quoteQuote

Hi every....!

Any have a sample in vb6 to stream with Bass_StreamCreateFileUser & Winsock vb6?

Thank you so much!!
Logged
(: JOBnik! :)
Posts: 984


« Reply #1 on: 21 Aug '08 - 17:10 »
Reply with quoteQuote

Hi Grin

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

« Last Edit: 21 Aug '08 - 17:14 by (: JOBnik! :) » Logged
shuttle
Posts: 70


« Reply #2 on: 21 Aug '08 - 17:19 »
Reply with quoteQuote

Hi JOBNIK!! Smiley
This code is very strange!!!
Anyway....I test it now....
Thank you my friend!

 
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines