Available Bluetooth Serial Ports in Vista

Available Bluetooth Serial Ports in Vista

am 21.04.2008 03:45:40 von Dave Harry

I'm using the following code to determine the available serial ports:

ComboBoxPort.Items.Clear()
For Each sp As String In My.Computer.Ports.SerialPortNames
ComboBoxPort.Items.Add(sp)
Next

It worked well in XP, but under Vista (now with SP1) the Bluetooth ports
don't show correctly.
We have half a dozen different brands and types of Bluetooth on various
computers, and all are displaying this behaviour.

I get this list:
COM1
COM3
COM4
COM10ñ
COM12ñ
COM92
COM11

The ñ letters are random and is different every time the sub is called.

Device Manager reliably shows:
Communications Port (COM1)
PCI Serial Port (COM3)
PCI Serial Port (COM4)
Standard Serial over Bluetooth link (COM10)
Standard Serial over Bluetooth link (COM11)
Standard Serial over Bluetooth link (COM12)
Standard Serial over Bluetooth link (COM9)

Any help, please?

--
Dave Harry

Re: Available Bluetooth Serial Ports in Vista

am 21.04.2008 21:00:05 von Dick Grier

Hi,

I filter the extra stuff "out" (I've also seen this under XP), in code. The
routine is a little tricky, to handle every combination (that I've seen - it
may not handle everthing that might get thrown at it)... Or, I simply
replace the GetPorts call with a call to System.Management to retrieve the
real names. For some reason, the WMI code in System.Management has no
trouble with this.

I've got this code in my book, but if you send me email, I'll send you a
copy.

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.

Re: Available Bluetooth Serial Ports in Vista

am 22.04.2008 18:56:20 von Dick Grier

BTW, I have found that System.Management is not fully supported under Vista
x64 (odd, that), so the filtering scheme seems to be the only method there.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.