1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Problem with BT virtual COM-Port

Discussion in 'Questions (Windows Mobile)' started by CryoGenID, May 5, 2009.

  1. CryoGenID

    CryoGenID Active Member Licensed 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
     
  2. agraham

    agraham Expert Licensed 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: May 5, 2009
  3. CryoGenID

    CryoGenID Active Member Licensed 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"
    Code:
    serial.New2 ("10:",19200,"N",8,1)
    Any more ideas? :)

    Thanks and best regards,

    Chris
     
  4. agraham

    agraham Expert Licensed 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.
     
  5. CryoGenID

    CryoGenID Active Member Licensed 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:
    Code:
    string p = "COM" + Port.ToString();
    Thanks a lot again and sorry for my mistake...

    Best regards,

    Chris
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice