Hi.
I have successfully made the connects, thanks.
The problem I am facing, is if I wrote the C equivient of this I will get all the information from the pipe, however if I use the code below I will only get 1 out of 2, 3 or 4 communications sent through the pipe. I know the problem isn't the server end because of this. Can someone tell me what I am doing wrong?
Thanks.
(none)
CODE
Private Const szPipeName = "\\.\pipe\pipe"
Private Const BufferSize = 65535
Private Declare Function CallNamedPipe Lib "kernel32" Alias "CallNamedPipeA" (ByVal lpNamedPipeName As String, lpInBuffer As Any, ByVal nInBufferSize As Long, lpOutBuffer As Any, ByVal nOutBufferSize As Long, lpBytesRead As Long, ByVal nTimeOut As Long) As Long
Dim Process As Boolean
Private Sub cmdRecvFilenamesStart_Click()
Dim res As Long
Dim myStr As String
Dim i As Long
Dim cbRead As Long
Dim numBytes As Long
Dim bArray() As Byte
Dim temp As String
Dim Executions As Long
numBytes = 1024
Executions = 0
If numBytes > BufferSize Then numBytes = BufferSize
ReDim bArray(numBytes)
Process = True
While (Process = True)
DoEvents
res = CallNamedPipe(szPipeName, 0, 0, bArray(0), numBytes, cbRead, 1)
If res > 0 Then
temp = ""
For i = 1 To cbRead - 1
If Not Int(bArray(i)) = 0 Then temp = temp & Chr(Int(bArray(i)))
Next i
txtRecvFilenames.Text = "(" & Executions & ") " & temp
Executions = Executions + 1
Else
If Not Err.LastDllError = 231 Then
MsgBox "Error Number " & Err.LastDllError & " attempting to call CallNamedPipe.", vbOKOnly
Process = False
End If
End If
Wend
End Sub
Private Sub cmdRecvFilenamesStop_Click()
Process = False
MsgBox "Process Stopped", vbOKOnly, "Process Stopped"
End Sub