Thanks, moeur, at least you know what you're doing
Made a couple of mistakes in my code (obviously)
In the form code
Code:
If (udtStreamInfo.dwError) Then
MsgBox "Error ID " & udtStreamInfo.dwError & " occured", vbExclamation
Else ' If there was no error,
' copy the contents of the buffer into
' the RTF Edit control
rtfText.TextRTF = gstrBuffer
End If
should be
Code:
If (udtStreamInfo.dwError) Then
MsgBox "Error ID " & udtStreamInfo.dwError & " occured", vbExclamation
End If
and in the module code, as moeur pointed out
Code:
Public Function EditStreamCallBack(ByVal dwCookie As Long, _
pbBuff() As Byte, _
ByVal cb As Long, _
ByRef pcb As Long) _
As Long '{
' pbBuff = pointer to byte array (thanks moeur :)
Dim strBuffer As String
Dim strRTFText As String
Dim i As Long
' Get the string contents
For i = 0 To (cb - 1)
strBuffer = strBuffer & Chr$(pbBuff(i))
Next i
' Set the no. of bytes received
pcb = pcb + cb
' Add buffer to text box
strRTFText = ghTextBox.TextRTF & strBuffer
ghTextBox.TextRTF = strRTFText
' Return zero to allow continuation of callback
EditStreamCallBack = 0
' }
End Function
hope this gets a bit further