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
For i = 1 To 20
SComm1.CommPort = i
If SComm1.CommName = "" Then
'// This Com Port does not exist at all
'// This port exists. Add it to the list
'// Also store i so that when the user selects
'// one we'll know which port to open
List1.ItemData(List1.NewIndex) = i
'// 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