cdholding image

comm64 home
comm64 download
comm64 forum
buy comm64

Introduction
Install Comm64
Why Not MsComm?

Properties
   .Break
   .CDHolding
   .CommEvent
   .CommPort
   .CTSHolding
   .DSRHolding
   .DTREnable
   .EOFEnable
   .Handshaking
   .InBufferCount
   .InBufferSize
   .Input
   .InputLen
   .NullDiscard
   .OutBufferCount
   .OutBufferSize
   .OutPut
   .ParityReplace
   .PortOpen
   .RThreshold
   .RTSEnable
   .Settings
   .STHreshold


Comm64 Properties
   .RxTimeout
   .TxTimeout

Comm64 Functions
   .readBytes
   .readString

   .writeBytes
   .writeString
   .PortExists

OnComm Event

Hardware/Cables etc
Loopback test plug

PortExists

Retrieves a boolean True/False indicating if a given port exists

ReadOnly at Runtime.

Only available using the Comm64 component - Not supported by MSComm32

         Syntax result = object.PortExists([Optional] value)
     
  object Name of the communications control.
  value

Numerical Com port number in the range 1 to 256

If you do not give a port number then the function assumes the current port (.ComPort)

  result A Boolean - PortExists True or False
     
  Examples  
   

If Comm1.PortExists(5) Then
     MessageBox.Show ("Com5 exists")
  Else
     MessageBox.Show("Com5 does not exist")
End If

'// Does Com5 exist ?
       
 

Remarks:
The only way that Micorosoft's MSComm32 ocx can check if a port exists is by attempting to open it and handling the error if the port doesn't exist. This new Comm32 control allows you to check whether a port exists without touching the port - This is a 'non-intrusive' read-only test meaning you can even do this if the port is busy.

Note that you do not need to change the .CommPort property - Simply pass the desired port number in the function call as shown in this example:-

'// We're going to populate a listbox with the short "Com" names of com ports that are known to exist.

Private Sub PopulateList( )
Dim i as Long

       List1.Clear
       
'// In this example we'll test for ports up to 32 - you can test up to 256 if you want.
       For i = 1 To 32
              If Comm1.PortExists( i ) = True Then
                     '// This port exists so add it to the list
                     List1.AddItem "Com" & i
                  Else
                     '// This port does not exist
              End If
       Next i
 
End Sub

 

 
Copyright (c) 2010 Axis Controls Ltd