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


Sets or Retrieves the status of the EvtCharEnable property. Enable or Disable EvtChar OnComm events. Used in conjunction with the EvtChar property.

Available at Design time and Runtime.

Only available using the SComm32 ocx (v8.0.5 or above). Not available with MSComm32


SComm1.EvtCharEnable = value

value = SComm1.EvtCharEnable

value:- A boolean value. true or false

SComm1.EvtCharEnable = True

SComm1.EvtChar = 4



MSComm32 is old and therefore still expects files to be terminated with the standard Dos EOF char (Ascii char 26). Modern file systems do not require or use the EOF character to indicate the End of File but some communications protocols may use other ascii characters such a EOT, ETX or any other ascii character as a way to indicate 'End of Message' or 'End of Transmision'.

The Ascii table has a number of such characters such as ETX ( 3 ) and EOT ( 4 ) and SComm32 allows you to use any ascii character.

The EvtChar property is used in conjuction with the EvtCharEnable property. If enabled this property will cause an OnComm event to be triggered when the EvtChar is received by the com port hardware. These properties are similar to the Microsoft EOFChar/EOFEnable properties but an evtChar OnComm event is triggered as soon as the evtChar is detected in the incoming data stream. Using this property you could set RThreshold=0 so that no evReceive events are ever triggered and simply wait for the evtChar event to indicate that the evtChar has arrived and is waiting to be read from the buffer.

Example: Lets assume we're receiving an unknown amount of data which we expect to be terminated by the ASCII EOT (4) character. We don't want to waste time reading or handling any data at all until we know the EOT character is waiting in the receive buffer.

    '// Set these values via the IDE or elsewhere in your code such as Form_Load event

InputLen = 0
    '// we will read all available chars from the buffer

RThreshold = 0
   '// we don't want any OnComm events when any data arrives.

EvtCharEnable = True
EvtChar = 4
    '// We're ging to react to the ascii EOT character

Private Sub SComm1_OnComm

    Select Case SComm1.CommEvent

        Case comEvReceive
             '// We'll just ignore any evReceive events             

        Case comEvEvtChar
             '// When this event is triggered we know
             '// our character is in the receoive buffer
             '// so we can read the whole message
             Text1.Text = S Comm1.Input

    End Select
End Sub