Posts: 3
Joined: Mon Jan 15, 2007 3:56 pm
Location: Spain

Close port COM Bluetooth locks program

Mon Sep 03, 2007 6:14 pm

We have developed a program using “Serial tools” control. We use Visual Basic 6.0. The program communicates with a device developed by us. The first time the program is running in a computer it must find out the COM port where the device is connected to. To do this it obtain the list of ports and it opens one by one to see if it receives messages from the device. Until now it works perfectly and there is no problem. It works correctly with physical serial ports and using RS-232 – USB adapters.

The problem we have now is when our program is running in a computer with bluetooth, concretely a laptop. The program checks the list of ports and when it arrives to a port bluetooth, the program does not respond and we have to press ctrl-Alt-del to finalize it. The program tries to open it, and after the timeout occurs then the program set the enabled property to false and the program is locked and it does not respond. The code is the following:

Private Sub OpenPort
Set mobjPort = New SerialXP.Port
mobjPort.BaudRate = 19200
mobjPort.EndTrigger = Chr(10)
mobjPort.ComPort = 6
mobjPort.Parity = 2
mobjPort.Timeout = 5000
mobjPort.Enabled = True
End Sub

'OnRead Event
Private Sub mobjPort_OnRead(Data As Variant)
If IsNull(Data) Then
MsgBox "Hello"
mobjPort.Enabled = False
MsgBox "Bye”
End If
End Sub

The instruction MsgBox "Hello" is executed but the instruction MsgBox "Bye" isn’t.

The COM6 is a virtual port Blootooth, but before arriving at the COM6 it opens and it closes the COM3 that also is a virtual port Blootooth without problems.

We have developed the program for several months. It is finished and we have distributed several copies of it. We have now encountered this problem and we need urgently a solution. We do not know if the problem is in serial tools control or where is it. If we had to use another control, we would have to rewrite the code and it would take us a long time, so we need a solution as soon as possible.

Return to “SerialTools”