ERROR_HANDLE_VALUE

Last post 11-22-2007 9:50 by Anonymous. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-31-2007 7:37

    ERROR_HANDLE_VALUE

    Hello

    Our team is developing app for mobile device equipped with Windows CE and .net Compact Framework 1.0. As you know there is no support for serial ports, so we have decided to use opennetcf.io.serial class.
    The class is great and has everything we need, so we are determined to run it. We have encountered problem with opening ports. Our computer has few ports - device we want to run is connected to com7. When we tried to open port from range 1-4, handle returned by CreateFile function was int like 3121212 etc. and function GetCommProperties was true.
    But opening port 7 give us handle int -188212212 (negative sign before int). And function GetCommProperties gives false.
    When we have debugged app (in event) we discovered ERROR_INVALID_HANDLE error from Marshal library (error no. 6).
    Do you have any suggestion what is wrong ? Is there any problem with creating file, sharing violation - maybe there is a autostart app..
    I would be very pleased for any answer.
  • 11-02-2007 6:25 In reply to

    Re: ERROR_HANDLE_VALUE

    Hello

    After some findings I have discovered that com port, which I am unable to open is called Powered Serial Port, has got 15 pin sub and driver for this device is serialV. Normal port is 9 sub and driver is serial (as registry entry in registry HKEY_LOCAL_MACHINE\Drivers\Active\).
    Port is opened with strange handle hPort and method WaitCommEvent cannot be executed, so the thread won't start.
    Do you have some ideas how to solve this ?

    Thank you
  • 11-15-2007 10:48 In reply to

    Re: ERROR_HANDLE_VALUE

    Hi

    After some findings I have found that problem caused error_invalid_handle was Active Sync and debugging session. Turning off active sync (after deploying) solved the problem. I can open and send data to the port ( but I can't debugging). Unfortunately still can't receive the data from our device ..
    I am using SerialCSharp Example. I have looked deeper to the code and I have noticed that loop inside if statement never being used. This is the code:
    if((eventFlags)) & CommEventFlags.RXCHAR) != 0)
    {
    (...)
    do
    {
    }while(bytesread>0)
    }
    Everything seems to be ok - there is no errors during executing API functions.
    Do you have some suggestions ? Maybe there is some port configuration problems ? Maybe active sync is still doing some bad things.I am determined to run this in our solution
    I would be appreciated for any answer.

    Thank you
  • 11-22-2007 9:50 In reply to

    Re: ERROR_HANDLE_VALUE

    Hello

    Finally I have found solution, as usual it was very simple and was caused by ActiveSync. I have changed configuration (hardware configuration in fact) and now I can receive data.

    Thank you
Page 1 of 1 (4 items)