Problem with BT virtual COM-Port

CryoGenID

Active Member
Licensed User
Longtime User
Hello everybody!

I am having a strange problem:
I am using Windows 7 Beta (yes I know it is a beta, but as everything else
works fine there I thought Basic4PPC would as well ;-) ) and a Toshiba BT-Stack.

The problem is this:
I have written a simple program which connects to my PDA via BT-virtual-COM-Port.
The compiled program works perfectly well under Windows XP.
But if I run it under Windows7, I get "Cannot open COM10".
If I use HyperTerminal within Windows7, I can open COM10 and communicate perfectly with my PDA.
So there seems to be some kind of compatibility issue with Windows 7 and Basic4PPC's serial-library ...

Any thoughts on how I could solve that?

Thanks a lot in advance!

Best regards,

Chris
 

agraham

Expert
Licensed User
Longtime User
This probably won't work but try suffixing a colon "COM10:". I seem to remember dimly some issue about COM ports higher than 9 sometimes needing a colon qualifier when being opened as file but I can't recall the details :(.

Also try "\\.\COM10" HOWTO: Specify Serial Ports Larger than COM9
 
Last edited:

CryoGenID

Active Member
Licensed User
Longtime User
Hello Agraham!

Thanks for your quick reply!
When I try to add the ":", I get an error "Input string was not in a correct format"
B4X:
serial.New2 ("10:",19200,"N",8,1)

Any more ideas? :)

Thanks and best regards,

Chris
 

agraham

Expert
Licensed User
Longtime User
Take a COPY of Serial2.cs from your Libraries folder and keep it safe. Find this line in Serial2.cs in the Libraries folder

string p = "COM" + Port.ToString();

and change it to

string p = "COM" + Port.ToString() + ":";

also try

string p = @"\\.\COM" + Port.ToString();

Optimise compile and check that the message box says that Serial2 was merged. Run it and see what happens. Post the result here and if one of them is successful I'll modify my SerialEx library to cope with COM ports > 9.
 

CryoGenID

Active Member
Licensed User
Longtime User
Agraham,

thanks for your reply!
I am such an :BangHead: ...
I included serialDevice.dll and serialDesktop.dll and not serial2.dll ...
As soon as I used serial2.dll it worked right out of the box, I applied your changes but it also works with the original setting:
B4X:
string p = "COM" + Port.ToString();

Thanks a lot again and sorry for my mistake...

Best regards,

Chris
 
Top