Jump to content

Recommended Posts


I´m making a script to send and receive data to/from Bluetooth serial, but I´m having a problem to connect to the com port.

The problem is that I´ve two ports, one is the COM4 and the other is COM6 (not using at the same time)

COM4 is a standard com port thought USB port that I can connect using CommMG, it´s working fine.

_CommSetPort($port, $sportSetError, 9600, 8, 0 ,1,0)

COM6 is a Bluetooth serial, that only works (I mean I can connect, send and receive data) with _WinAPI_CreateFile.

$openport = _WinAPI_CreateFile("COM6", 2, 6)
 . . .
 _WinAPI_ReadFile($openport, DllStructGetPtr($tBuffer), 1, $nRead)
 $sText = BinaryToString(DllStructGetData($tBuffer, 1))


If I try to connect the COM4 with _WinAPI_CreateFile it´s not working... and when I try to connect with CommMG to COM6 it´s give a -16 (Port not found) error..

The problem is:

How can I open/connect to the bluetooth (COM6) port using CommMG  ( to write one single script instead of two - one using CommMG and another using  _WinAPI_CreateFile)...


Thanks in advance!

Edited by lesther
added details
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...