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.DevicePresentMessageBox.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