Hi,
You can use WMI, which will report which serial ports are installed (but,
the System.Management wrapper doesn't seem to work for anything other than
installed modems -- I have example code in my book). Or, you can simply
open each possible port in turn. If the port opens it is available, and
(usually) if there is an error, the error return will allow you to determine
if some other program is using the port.
The System.IO.Ports.GetPortNames method in Visual Studio 2005 has this
"built-in."
Dick
--
Richard Grier (Microsoft Visual Basic MVP)
See
www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.