Enumerates COM Port

  • Thread starter Thread starter SS
  • Start date Start date
There are registry keys that you can look at to determine what COM
ports are installed however this does not always work - especially if
you are using COM ports that are provided by an add-on serial adapter.
The easiest way to determine what ports are installed is to try to
open each port in a loop (say COM1 to COM32) and if the port opens,
immediately close it and mark it as being available. If it does not
open then trap the error and mark the port as unavailable.
 
The easiest way to determine what ports are installed is to try to
open each port in a loop (say COM1 to COM32) and if the port opens,
immediately close it and mark it as being available. If it does not
open then trap the error and mark the port as unavailable.

This could take a very long time, when you have a bluetooth card inside the
PC...
They install multiple COM-Ports, and if already paired, built up a
connection and timeout. This could take 20 seconds per COM-Port...

Regards,

Martin
 
Back
Top