I'm using MSComm control for developing a Personal Response System.
Following are the settings for MSComm control that I'm using:
Following is the onComm event of the MSComm control:Code:MSComm1.CommPort = PortNo MSComm1.Settings = "115200,N,8,1" MSComm1.InputLen = 100 MSComm1.RThreshold = 1 MSComm1.SThreshold = 1 MSComm1.PortOpen = True
When the user gives response from his handset then each response is processed in the onComm event.Code:Private Sub MSComm1_OnComm() Dim i As Integer, j As Integer, k As Integer Dim remoteno As Integer, keypressed As String Dim a() As Byte Dim buffer() As Byte Dim BufferLength As Integer Dim strbuffer As String Dim diff As Double Select Case MSComm1.CommEvent 'errors Case comEventBreak Case comEventCDTO Case comEventCTSTO Case comEventDSRTO Case comEventFrame Case comEventOverrun Case comEventRxOver Case comEventRxParity Case comEventTxFull Case comEventDCB 'events Case comEvCD Case comEvCTS Case comEvDSR Case comEvRing Case comEvReceive strbuffer = "" BufferLength = MSComm1.InBufferCount If BufferLength > 0 Then buffer = MSComm1.Input k = 0 i = UBound(buffer) For j = 0 To i If j = 1 Then remoteno = buffer(j) ElseIf j = 5 Then keypressed = buffer(j) End If strbuffer = strbuffer & buffer(j) & ":" Next j End If 'MsgForm strbuffer Case comEvSend Case comEvEOF Case Else End Select If BufferLength > 0 Then 'Process user's response.... End If End Sub
It's working fine for small no. of handsets but the problem arises when a large no. of handets are used.
Any help would be grateful.
Regards,
Raman


Reply With Quote