How to handle a different device using RAPI with OpenNETCF.Desktop.Communication

Last post 11-12-2008 9:09 by TimH. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-11-2008 16:04

    • TimH
    • Top 500 Contributor
    • Joined on 11-11-2008
    • Posts 2

    How to handle a different device using RAPI with OpenNETCF.Desktop.Communication

    I have a desktop app that runs great using OpenNETCF.Desktop.Communication--as long as I don't remove the device from the dock and insert another (or the same) device in the dock while the desktop app is running.  In other words, if I exit the desktop app, then put my next device in the dock, and then run my desktop app again, all is fine.  But I need to know if there is way to change devices in the dock and still expect the desktop app to run properly--without having to close out of the desktop app each time.

    If I don't exit and re-run the desktop app, then the error I get is this: RAPI exception was unhandled.  Error 0 cannot create process.  The system cannot find the file specified.

    Here is the pertinent code I am using...in the Load area, I do this:

    Try

    myrapi.Connect()

    Do While Not myrapi.DevicePresent

    MessageBox.Show("Please connect your device to your PC using ActiveSync and " & _"before clicking the OK button.", "No Device Present")

    myrapi.Connect()

    Loop

    And then I have a Sub that responds to a button click, where I move data to and from the scanner, and run an app as well.  Specifically, the line where I get the error is this one:

    myrapi.CreateProcess("\My Documents\ecotFT.exe", "GetLoc")

    Like I say, I don't get the error if I exit the desktop app, insert the next scanner in the dock, and restart the app.  In other words, this "...ecotFT.exe" program is alive and well on the scanner, but it's almost as though the desktop app doesn't "see" the mobile device.

    Any idea why the desktop app gets "upset" when I remove a scanner from the dock and put a scanner back in the dock while the app is running...and what I can do to make it work with the 2nd scanner---short of forcing the user to exit the app each time they need to swap scanners in the dock?  TIA

  • 11-12-2008 9:09 In reply to

    • TimH
    • Top 500 Contributor
    • Joined on 11-11-2008
    • Posts 2

    Re: How to handle a different device using RAPI with OpenNETCF.Desktop.Communication

    I failed to mention that I also tried removing the myrapi.Connect() from the Load Sub, and placed it in the first line of the Button Click sub--in an attempt to get it to "re-connect" each time that sub is run.  This is the same sub that is giving me the myrapi.CreateProcess error shown above...so clearly the change I made is not helping.

     

Page 1 of 1 (2 items)