cdholding image

comm32 home
comm32 forum
buy comm32

Introduction
Install Comm32
Why Not MsComm?

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


Comm32 Properties
   .DeviceName
   .EOFChar
   .EvtChar
   .EvtCharEnable
   .OutPutEx
   .OutPutMode
   .ParallelEnable
   .TxTimeout

Comm32 Functions
   .getByte

   .GetPortStatus
   .InstalledDrivers
   .putByte
   .PortExists
   .ReadBytes
   .ReadString
   .WriteBytes
   .WriteString

OnComm Event
Hardware/Cables etc

InstalledDrivers

Retrieves the long "friendly" name (or names) of a given port - even if that port (for example a removable/USB port) is not currently connected. See remarks below.

ReadOnly at Runtime.

Only available using the Comm32 ocx. Not supported by MSComm32

         Syntax result = object.InstalledDevices(value)
     
  object Name of the communications control.
  value Numerical Com port number in the range 1 to 256
  result A String containing the Windows FriendlyName of the given port number.
    Returns an Empty String if no driver is installed - See remarks below.
     
  Examples  
   

MsgBox (Comm1.InstalledDevices(5) )

 
       

Remarks:
The purpose of this function is to see if a device driver for a Com port is installed. It doesn't matter if the actual hardware is connected or not. For example if you queried InstalledDrivers(5) then you may receive a result such as "USB RS232 Port (COM5)" even if Com5 was not physically connected. This would indicate that a driver is installed and that Com5 could be quickly enabled by connecting the relevant USB adpater.

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 Long "Friendly" names of com ports. Because these may be removable ports we'll also use the PortExists property to indicate if the hardware is [Available] or [Missing].

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 " [Available] " & Comm1.InstalledDrivers( i )
                  Else
                     '// This port does not exist - maybe the driver is installed but hardware is not connected

                     '// We'll ignore empty results because that means that no driver is installed for that port

                     If Comm1.InstalledDrivers( i ) <> "" Then
                          List1.AddItem " [Missing] " & Comm1.InstalledDrivers( i )
                     End If
              End If
       Next i
 
End Sub

The result of this might create a list like this:-

[ Available ] Communications Port (COM1)
[ Available ] Communications Port (COM2)
[ Missing ] Prolific USB-to-Serial Port (COM4)

 

 

Copyright (c) 2010 Axis Controls Ltd