Communication between WinCE device and Windows PC over USB

462 views Asked by At

I wrote a simple WinCE application in C++ that performs basic tasks like saves notes, sets reminders, and turns on/off my device's LED. To get more familiar with programming, I now want to transfer over USB and print to a command prompt on my PC some of this data. Any information (reading material, videos, libraries I should look into, etc.)?

1

There are 1 answers

0
Carsten Hansen On

This is an incredibly broad question and I think the answer depends entirely on what kind of programming you are looking to gain familiarity with, your level of experience, and the amount of time you are willing to put in.

That said, I would recommend one of the following three approaches, in increasing levels of difficulty:

  1. If your WinCE device supports ActiveSync and the PC runs Windows, use Microsoft RAPI. With RAPI, you can write PC software to perform a number of remote file- and registry operations on your WinCE device. RAPI also supports a generic, ioctl-style RapiInvoke function, which allows you to call into your own custom dll's on the device, and set up a communication stream between the device and PC.
  2. Alternatively, if your WinCE device and PC support Remote NDIS, you can use sockets to communicate with the device, exchange information etc. This is really no different from using sockets over any IP-based network, and the experience gained would be more generally applicable than a RAPI-based implementation. Most Windows PC's either support RNDIS or drivers are available for download, but, to my knowledge, few WinCE devices do, at least out of the box.
  3. Finally, there's the DIY solution - implement custom USB drivers for the PC and WinCE device yourself. This doesn't have to be as scary as it might sound. Microsoft Platform Builder comes with sample code that allows you to fairly quickly get a simple, stream-based driver off the ground, and various device driver kits exist for PC's that free you from writing any kernel-mode code at all.