SComm32 Communications OCX

   







Properties/Methods

. 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

CommName

Retrieves the full Device Name of the communications port. (The Windows "Friendly Name" of the device)

Only available using our SComm32 ocx. Not available with MSComm32
 

Syntax:-

value = SComm1.CommName
 

value:- A string containing the Windows Friendly name of the device/port..
 

 

Example:-

         Text1.Text = SComm1.CommName

    


Remarks:

All Windows Com ports have 'Dos' compatible names such as "Com1", "Com2", "Com23" etc. But, since Windows95, com ports also have more descriptive names which often give more information about the device. Windows refers to these longer names as "Friendly Names".

This property returns the WIndows Friendly Name. (Or an empty String if the port does not exist)

The following are examples of Windows Friendly Names.

"Communications Port (Com1)"

"Prolific USB-to-Serial Port (Com18)"

"NetMos PCI Serial Port (Com23)


Example - When displaying a list of available Com ports you may prefer to display the more descriptive device name.

We're going to populate a listbox with the full device names of all existing ports - we'll loop through changing the CommPort number and then read the DeviceName of that CommPort - You might display a list like this to allow your user to select an available port before setting the PortOpen property to open the selected port.

In this example we'll test for ports Com1 to Com20 - you can test up to 255 but that might take a few seconds so just search the expected range if possible

Private Sub PopulateList( )
Dim i as Long
    List1.Clear
 
    For i = 1 To 20
        SComm1.CommPort = i
            If SComm1.CommName = "" Then
                '// This Com Port does not exist at all
             Else
                '// This port exists. Add it to the list
                List1.AddItem SComm1.CommName
                '// Also store i so that when the user selects
                '// one we'll know which port to open

                List1.ItemData(List1.NewIndex) = i
           End If
    Next i
End Sub

'// Now when the user selects a port we'll get the portnumber from List1.ItemData and open that port ready for use.
Private Sub List1_Click( )
    SComm1.CommPort = List1.ItemData(List1.ListIndex)
    SComm1.PortOpen = True
End Sub