SComm32 Communications OCX



. Break
. CDHolding
. Commevent
. CommName
. CommPort
. CTSHolding
. DSRHolding
. DTREnable
. EOFChar
. EOFEnable
. EvtChar
. EvtCharEnable
. Handshaking
. InBufferCount
. InBufferSize
. Input
. InputLen
. InputMode
. NullDiscard
. OutBufferCount
. OutBufferSize
. Output
. OverlappedIO
. ParityReplace
. PortOpen
. Read
. RThreshold
. RTSEnable
. Settings
. SThreshold

OnComm Event
Hardware/Cables etc
Loopback Test Plug


Retrieves a numerical event code indicating the most recent event or error.

MSComm32 and SComm32 have the same syntax and SIMILAR functionality (SComm32 is improved. See below)


value = SComm1.CommEvent

value:- A numeric value being one of the following.
1 comEvSend
  There are < SThreshold number of bytes remaining in the transmit buffer
2 comEvReceive
  There are >= RThreshold number of bytes in the receive buffer
3 comEvCTS
  The state of the CTS input changed.
4 comEvDSR
The state of the DSR input changed.
5 comEvCD
The state of the Carrier Detect input changed.
6 comEvRing
Ring Indicate
7 comEvEOF
End of File character was read.
1001 comEventBreak
A break signal was received/detected.
1004 comEventFrame
The hardware/Driver detected a framing error
1006 comEventOverrun
The hardware could not receive data fast enough and some was lost.
1008 comEventRxOver
Receive Buffer Overflow. There was no room in the receive buffer and some data was lost.
1009 comeventRxParity
Parity Error.
1010 comeventTxFull
Application tried to queue a character into the transmit buffer while the buffer was full.
1011 comEventDCB
An error occured while setting up the Windows Com Driver.



Private Sub SComm1_OnComm

   Select Case SComm1.CommEvent

      Case 2 '// evReceive
         Text1.Text = Text1.Text & SComm1.Input

      Case 1001 to 1011 '// An Error
         Text2.Text = "A Comm Error Occured"

      Case Else
         '// Something else happened.
         '// Lets ignore it.

   End Select
End Sub


When using Event driven communications you would generally respond to the OnComm event and then interrogate the CommEvent property to decide what the cause of the OnComm event was. (The CommEvent property contains the code/reason for the raising of the OnComm event)

If you are not using an OnComm event in your project then you can still interrogate this property to retrieve the most recent event or error status.

SComm32 Improvement(s) over MSComm32
Under some conditions MSComm32 OnComm event is re-entrant. This means that the CommEvent property can change while you're still (before you're finished) using it inside an OnComm event. This can cause errors in your program that are almost impossible to debug.

SComm32 will never change the CommEvent property while your code is running inside the OnComm event. Any further events are queued so that you get them one after the other - the CommEvent property will therefore not change unexpectedly.