Enumerating available comm ports with friendly names.
Title: Enumerating available comm ports with friendly names.
Question: Serial (and virtual serial) PNP Devices (PCMCIA, USB, Bluetooth) get assigned "arbitrary" comm port numbers.
To help users to select the correct comm port it would be helpfull to list them with device friendly names.
The supplied function helps this goal.
Answer:
(*
The function below returns a list of available COM-ports
(not open by this or an other process), with friendly names. The list is formatted as follows:
COM1: = Communications Port (COM1)
COM5: = NI Serial Port (Com5)
COM6: = NI Serial Port (Com6)
COM7: = USB Serial Port (COM7)
COM8: = Bluetooth Communications Port (COM8)
COM9: = Bluetooth Communications Port (COM9)
The function uses the setupapi (setup api) unit that is available from
I have verified the code and it worked for W2000, WXP, W98. It does not work for W95, and NT 4.0. I did not check WME but I guess it will work with WME too.
*)
function SetupEnumAvailableComPorts:TstringList;
// Enumerates all serial communications ports that are available and ready to